You're referring to the Union Pacific, Northern Pacific, etc, the transcontinentals. There was a lot of private financing complementing the federal "funding" of those, but also of other lines.
The Pennsylvania Railroad electrified the NY-Wash corridor in the 1930s without gov't assistance, to...