The way I understand the setup: The block is initially at rest at some height above the spring. The spring is initially at rest oriented vertically with one end on the ground and at it's natural length (though if its not a massless spring it would compress somewhat due to its own weight). Then, the block is dropped, it lands on the spring compressing it and at some time the maximum compression is reached.
At maximum compression the block is momentarily stationary (between moving down and back up again) and the spring should be stationary as well (though I expect there would be some vibrations). My point is initially and at maximum compression there is no kinetic energy. Overall the initial gravitational energy is converted to elastic potential energy.
With a massive spring it becomes a bit more involved. The spring will compress to some extent under its on weight and as it is compressed its centre of mass will move down reducing its gravitational potential energy.
To understand why the answer they give in the physics text book makes sense, there's one slightly counter-intuitive thing to remember: if you try to lift something up "at a constant speed" the force you apply is not constant. We humans lift objects at a constant speed so intuitively, that it is easy for us to get the illusion that we're applying a constant force, but that's not actually the case.
If an object is stationary, and you apply a force exactly equal to the force of gravity but in the upwards direction, the object will not move. This should make sense, if you think about it. The "normal force" from the ground holding up the object is exactly equal to the force of gravity if the object is lying there on the ground. To lift it off the ground, you have to apply more upward force than the force of gravity so that there is a net upward force.
Now while you're doing this, the object is not moving at a constant speed. It is accelerating, exactly as predicted by F=ma. After a short while, its upward speed is exactly the "constant speed" you wanted, and you intuitively decrease the force you are exerting on the box until the force you are applying matches that of gravity exactly. In most intuitive cases, this acceleration occurs quickly, so we get tempted to ignore it, but it's absolutely there. In other situations, it's not so easily ignored. Consider the case of large cranes:
When you have a crane lifting something as massive as this, it turns out that it's not effective to have the operator's joystick controlling the position of the crane up and down. They actually control the force that the crane applies when lifting the object. They have to be aware of the acceleration phases that we often intuitively overlook. They will actually put more force on the object to get it moving upward and then decrease their force so that it doesn't accelerate up out of control.
When you reach your height, h, you stop. To stop, what you actually do is decrease your force to less than that of gravity, and it decelerates. Like before, the process is not instantaneous, but on human scales it often occurs fast enough that we don't pay attention to it. Once it has stopped moving upward, we once again apply a force exactly equal to that of gravity to keep it stationary.
So during the initial acceleration period, your object is gaining kinetic energy because it velocity is increasing. During the middle period, where your force matches gravity's exactly, its velocity stays the same, so its kinetic energy remains the same. Any work you are doing (force * distance) is going into increasing its potential energy. Near the top, the object decelerates back to motionless. During this time, all of the kinetic energy you built up during the acceleration period is converted into potential energy (along with any potential energy coming from the fact that you're still applying force while its decelerating, it's just less force than before)
Best Answer
The answer is wrong. Some author confused the situation when the ball is moving only vertically (and a graph as a function of time) with this case where there is horizontal motion. The horizontal component of the velocity is constant in a ballistic trajectory, it is the same at points A, B, and C.
The kinetic energy is zero only when the ball is stationary, and the ball is stationary only at E: so this is the only point where the kinetic energy is zero.
So... do not trust this book.