To the earlier comment that beyond land grants, government has done little to nothing to help railroads; this was more or less true up until about 15 - 20 years ago but; not since.
Pennsylvania contributed a lot of money to Conrail’s clearance project that enabled the railroad to handle doublestacks between Pittsburgh and Harrisburg back in the mid-90’s.
More recently; Virginia and the Federal government contributed to NS’ Heartland Corridor clearance project that raised clearances on the former N&W for the same reason.
The state of Georgia has contributed to CSX’s intermodal terminal near Chatsworth, GA.
And each year the Federal government awards TIGER grants - principally to short line and regional railroads that enable them to upgrade their properties.
There are more examples such as the CREATE project in the Chicago area but; I believe you get the point.
Curt