In case you were visiting from the US, by far the cheapest way of travelling is the Eurail pass.
https://www.eurail.com/en/eurail-passes
However for $300 you get 7 days of unlimited travel throughout Europe (not just
the EU), because the UK is included and as stated in this report it is one of the most expensive in Europe.
Those 7 days can be spread out over a month, so you only use the days where you are actually travelling on train.
[Edit] If you are only going to be in one country, then it does make it cheaper. $200 for 7 days worth of travel over a month for France, for example.