What is the difference between a socialist economy and a capitalist economy?

The fundamental difference between the two lies in the ownership of the means of production. Socialism is the public ownership of the means of production, owned by all the people; capitalism is the private ownership of the means of production, and the means of production are owned by individuals.

Both can implement market economy. Market economy is not a patent of capitalism; it is just one of the processes of economic development. A socialist economy can be both planned and market-based.