Socialism may "work" as an economic system but not well. It is inefficient. Profits and losses in a capitalist economy creates efficiency.
In the former USSR half of the companies that made bricks in the entire country were not brick making companies. But if they wanted bricks to build with they had to make them