Because there is more than just the gravitational field involved. There is also the hyperbolic trajectory of the spacecraft, and the angular momentum of the spacecraft-planet system that becomes relevant to the transfer of kinetic energy to the spacecraft.