At the same time that homesteaders were getting free land from the government, large tracts of land were granted to railroads by both the states and the federal government. The goal was to encourage the railroads to build their tracks where few people lived, and to help settle the country.