However the railway ought to be more expensive overall due to the other costs: requires build-out and maintenance of extensive ground based network, including some prime real estate; requires much longer occupancy of vehicles; requires much more man-hours for each vehicle crew. Sadly in most settings (like continental Europe) the fixed costs of rail are barely visible to our considerations due to the governmental funding. Meanwhile airplanes only require build-out of the end-points, and the crew required is minimal.
The only meaningful way of fixing the problems with rail is 1) high speed (Mach 0.5 ... 1); 2) de-coupling from wheels-on-rails as the source of noise, drag and speed limitation; 3) de-coupling from expensive on-the-ground infrastructure as cause of high costs and NIMBYism; 4) high automation, little to no amenities; 5) smaller vehicles, more frequent departures. All in all, going in the airplane-like direction. Hyperloop may just be the thing, if it ever becomes large scale commercial.
[1] per passenger * km. Example: https://www.theprch.com/this-vs-that/fuel-efficiency-planes-...