Walk-up/on-the-day fares for train tickets in the UK are very expensive.
Picking London to Edinburgh as an example (~400 miles in ~4.5 hours) you'd pay £125 off-peak and £150 peak fare for a train today (there are generally 2 an hour).
Booking in advance (up to ~84 days in advance) you can get those same tickets as cheap as £24 but you're tied to a specific departure time/date (and changing date/time can be expensive).