Answer: They were given many acres of government-owned land for every mile created.
Congress passed the Pacific Railroad Act in 1862. This led to the creation of the Union Pacific and the Central Pacific. Because Congress was interested in building the railroad quickly, they provided two incentives to the companies.
First, they gave each line twenty alternate sections of land for each mile of track completed. Second, they gave them loans: $16,000 for each mile of track of flat prairie land, $32,000 per mile for hilly terrain, and $48,000 per mile in the mountains.
These two incentives meant that the railroads would compete in order to be able to build the most miles and get the most land and money.