I’ve never seen anyone confuse capitalism with socialism or communism.
European countries like Norway, Sweden and Denmark are not socialist nations. They have free market economies.
nations like Cuba, Vietnam, Laos and China do not have a free market.
Markets existed way before capitalism. Capitalism is not an economic system strictly defined by markets, but rather by the production and delivery of goods and services for a profit, via the extraction of surplus value from wage labor. The foundation of capitalism is the exploitation of human wage labor. The capitalist employer (exploiter) rents the life of an employee (exploitee) for eight, twelve, or sixteen hours daily, to produce a product or deliver a service, for let's say $18.00 hourly, irrespective of the fact that the employee is producing $100 hourly in products or services. The capitalist exploits the human labor by keeping the surplus or difference between the wage and what is actually being produced.
Under capitalism, nothing gets produced to meet human needs, unless there's a profit or an opportunity for a capitalist to accumulate capital. If a product or service isn't commercially viable, then it's not produced or delivered, irrespective of how much people need it. This is why you can have warehouses full of food and people can still go hungry. Here in NYC, after bakeries, grocery stores, and restaurants close, they throw away eatable, even fresh food in garbage bags, but before they do that, they pour Clorox on it, to stop anyone from eating it. Under capitalism, you can have millions of vacant homes and apartments, and millions of homeless people living out in the street.
Most modern industrialized nations apply many socialist principles to their economies. They're essentially mixed economies
(a bit of capitalism, with some socialism). The countries that currently identify as socialist or Marxist, are what is left of those nations that once allied themselves with the USSR. With few exceptions, they're heavily sanctioned and often threatened with war.
Markets, according to Marx, can exist in socialism, especially in the beginning phase of transitioning production to a fully socialized and democratized, non-profit system, that is publicly owned and centrally planned. In the not-too-distant future, due to advanced automation and artificial intelligence, socialism is going to become a necessity. We will be forced, not through the barrel of a rifle, but by necessity, to adopt socialism, due to advanced production technology.