Whenever highways are laid out to cross railroads on public lands, the owners or corporations using the same highway shall, at their own expense, so prepare the highway that it may cross without danger or delay, and when the right-of-way for a public highway is obtained through the judgment of any court, over any railroad, no damage shall be awarded for the simple right to cross.