Generally I'd agree that it's better to just let the government subsidise it (or just run it) and accept the cost in exchange for the economic benefits.
However, there is one way to make it work privately, and that's to capture some of those economic benefits by buying the land around stations. If someone buys some relatively cheap land near a city and then builds a train line from there to the centre, the value of that land increases and so they can charge higher rents on any housing, offices or shop units built there.