In an instant, the ball's forward motion is reversed and it is sent flying along a new trajectory. The force between the bat and ball compresses the spring, converting the kinetic energy of motion into potential energy. At the point of maximum compression, the ball momentarily comes to rest. Then, the spring expands, converting potential energy back into kinetic energy. Losing energy Because the collision is highly inelastic, not all of the kinetic energy is restored, however.
Energy is lost to the ball in other ways, as well.
So it is reasonable to ask what effect this reaction force has on the bat. When the bat strikes the ball, the bat will naturally recoil. That recoil force is energy that is also lost as far as the ball is concerned. But the heavier the bat, the less the recoil. But of course all things are not equal, because you also have to swing the bat.