Trains can't climb hills. Therefore railways can't be built everywhere which increases costs significantly.
> The trains are fitted with one or more cog wheels or pinions that mesh with this rack rail. This allows the trains to operate on steep grades above around 7 to 10%, which is the maximum for friction-based rail. [0]
[0] https://en.m.wikipedia.org/wiki/Rack_railway
[1] https://en.m.wikipedia.org/wiki/Category:Rack_railways_of_Sw...
https://en.wikipedia.org/wiki/List_of_steepest_gradients_on_...