Assuming regenerative braking you can get much of the energy back again when the train goes down a hill. But your point broadly stands - for reasons like limited wheel/rail adhesion heavy trains and steep gradients seldom go together.
Depending on how the ‘stations’ work there maybe slopes up to them and then slopes down from them to help decelerate and accelerate the trains in and out of the stations
Crossrail in London does this
Right, but that’s a lot different from following mountain slopes to maintain a constant depth.