Just as you can take a tiny regenerative toy car, give it a few little revving pushes on the floor (let's say 4 feet of regeneration), you can let it go and have it go 100 feet, as all that mass you used from your arm to charge the battery was transferred (obviously not 100%) to the battery. It's not perpetual motion. It's just converting mass into energy. Pure physics here.
This is the same concept when using water, rocks, sand etc. and gravity for batteries. It's just a simple transfer of potential energy.
They work because they transport matter from a higher place to a lower place and therefore are much heavier downhill then uphill.
Quote: When regenerative braking is employed, the current in the electric motors is reversed, slowing down the train. At the same time, the electro motors generate electricity to be returned to the power distribution system
https://www.ctc-n.org/technologies/regenerative-braking-trai...
The extra steps are useful for sure. Storing the generated energy in batteries works on a route where the net cargo movement is downhill even if there are some uphill sections along the way.