Use a back-pressure valve right at the pump discharge; it will open promptly when the pump starts, and close smoothly as the pump coasts to a stop.
For those who don’t know, a back-pressure valve is one operated by the discharge pressure of the pump itself [visualize a pressure reducing valve, but with the diaphragm pilot line connected to the upstream side of the valve instead of the downstream side, and that opens the valve on increasing pressure instead of decreasing pressure]. If properly calibrated such that with the pump at rest the valve is fully closed, no gravity-flow will occur when the pump isn’t running.