If lands are appropriated for the relocation of any state or county highway, which relocation is deemed necessary to avoid one or more railroad crossings or other dangerous places, the expenses shall be apportioned on the basis of benefits received by the railroad, if any, and the benefits received by the state or county, if any.
SDCL 31-27-6