Machines like Nespresso and Keurig use coffee which is prepackaged in capsules. The machines are relatively inexpensive, the coffee is relatively expensive. Espresso machines make espresso, which is different than coffee - it's more concentrated, servings are smaller, and the process for making it is different. Most espresso machines are operated manually, and have a bit of a learning curve. Semi-automatic and fully automatic (aka superautomatic) machines usually make not only espresso but can also prepare frothed or foamed steamed milk for coffee beverages like cappuccinos, lattes, and flat whites, sometimes others. They can often make other purely coffee drinks like ristrettos. The more beverages a machine can make, and the more automated they are, the more expensive they are.
Espresso machines of all types require ground coffee. You can buy it in that form or can buy a separate bean grinder, or can buy a superauto which has an integrated grinder.
Surfing vendor sites like this will introduce you to many types of machines in different price ranges:
https://www.wholelattelove.com/