In simple words, one of the reasons why the United States Government gave subsidies to Railroad companies was the benefits railroads would bring to the regions.
At the time, the United States wanted to connect the coasts in order to favor trade and conquer the West, and it wouldn't be possible if Railroad companies had to rely only on bank loans and their own capital, and since the benefits for the US and its population would be humongous they subsided the companies.