The story
In both senses, because running such trains is required by an act of Parliament.
Etymology from Wiktionary, CC BY-SA 4.0.
Today it means: A cheap, slow public passenger train as provided for under the Railway Regulation Act 1844 (which ordered railways to run at least one train a day each way, at a cost to passengers of no more than one penny a mile, on every railway line in the country). Full definition →
In both senses, because running such trains is required by an act of Parliament.
Etymology from Wiktionary, CC BY-SA 4.0.