And none of the liberalization rules (...) have managed to significantly increase the market share of railways as a whole, versus air or road.
It did for air at least. Ryanair and Easyjet thrived with the EU air market deregulation by allowing them to go full bonkers with their strategy.
If air travel worked on the basis of franchising, neither would have been very successful,.
Plus, air travel mostly depends on the airports, ATC and communication/nav points. The air itself does not need to be upgraded nor maintained. Only managed.
Low cost carriers thirst for money led them to avoid expensive things like jet bridges and baggage check-ins, meaning that having a successful low cost air operation at the airport turns out to be much cheaper, since you don't need to install a lot of extremely expensive equipment, and respective personnel.
The strategy for passenger rail service has always been half-arsed, as it always implied that the competition will come before the service, rather than during it.
Plus, the high dependence on the quality of the infrastructure means that any mismatch between infrastructure strategy and train operation strategy comes at a huge cost for the latter.
In Portugal the market share for cargo hasn't gone up as much as hoped because the infrastructure has been the main hurdle to the sector.
The main issues are the limitations to the length of trains, bad track maintenance, short or badly designed terminals, excessive traffic on some routes, and political pressure to remove "ugly and unwanted" infrastructure from extremely strategic locations.
Passenger wise, the government contracted the public service to by run by CP - Comboios de Portugal (the state owned company), but anyone can run recreational, long haul, highspeed and international routes. Not only will the government do nothing, CP will also back off from either of those services if it can't compete.