Imagine that a ball of mass $m$ is launched at a block, which also has mass $m$. Attached to the block, facing the ball, is a massless spring with a massless board at the end. Alternatively, we can assume that the block, spring, and board taken together have mass $m$. Assume there is no gravity and no dissipative forces. Suppose that the length of the spring and the spring constant are sufficient to stop the ball. When the velocity of the ball is zero, the spring becomes locked; it has some mechanism that physically prevents it from expanding or contracting, which is activated using an arbitrarily small amount of energy. After the interaction, how much potential energy is stored in the spring?
In solving this problem, an apparent paradox appears. Because the block-spring system and the ball have the same mass, and because the ball is at rest after the interaction, momentum conservation implies that the final velocity of the block should equal the initial velocity of the ball. This would imply that the final kinetic energy of the block is the same as the initial kinetic energy of the ball. But then there can be no potential energy stored in the spring, even though it has been compressed.
Obviously such a setup is impossible because of the massless spring and the lack of energy dissipation. However, these assumptions are fairly standard in physics, so one would not expect them to lead to a contradiction.
Also, I am aware of the principle that an idealized ratchet-like mechanism cannot exist because it could be used to violate the second law of thermodynamics. I understand that argument, but the problem here is not a violation of the second law, but rather a contradiction of energy and momentum conservation. Which of the premises of the problem is responsible for this contradiction, and why?