For the most part they were not funded by subsidies. East of the Mississippi (very roughly) they mostly had to buy their own land and everything. Out west they were given free land, but the value of that land without railroads was approximately zero.