Or...
The government (via state-owned National Rail) owns all the track and the land the track is on. If it offered cheap leases to mobile phone companies for masts and cables along all of the UK's rail routes, then 3G/4G masts every 300 yds (including in cuttings, tunnels, etc) would mean mobile broadband for passengers under their existing phone packages and back-up comms for the rail operators. No public money needed.