Minor quibble: I would have said the initial rush of water gives you back exactly the amount of energy you used to push the pipe down into the water in the first place. In both cases, the energy equals the work of displacing the same volume of water against the same pressure. (With opposite signs, of course.)
Ok, here's my quibble quibble
On the way down you get help from gravity to push the enclosed pipe down. Also, the waves and temperature and salinity of the ocean vary, so by the time the pipe is uncorked conditions will have changed (ever so slightly) from when the pipe was originally submerged, thus resulting an "approximate" return of energy from the system.
It's funny that I originally chose to say "similar" return of energy rather than "exact" because I was afraid someone would quibble with me about it being an "exact" return. And then the opposite quibble happened. Life is funny