The explanation given in the picture condemns capitalism, not socialism.
Capitalism is the system that assumes actors work in their own rational self interest. It's when capitalism gives "free stuff" that people need to worry about the hidden cost.
The transaction in this case is that the mouse trades its life for a chance of getting food. But, as is typical for capitalism, the person who offers the transaction is intentionally concealing its true cost, making it impossible for the mouse to make any rational decision.
The person who originally made that meme seems to believe that socialism simply means "free stuff". But a mouse trap baited with food is an absolutely textbook example of capitalism.