Whenever the funds of the state are being expended for the construction, maintenance, or repair of a public highway, the State Department of Transportation shall have the power and authority to compel all railways operating in this state to construct viaducts, tunnels, underpasses, or bridges to the full extent of the width of the right-of-way and over the tracks as owned or operated by any railway when, in the judgment of the State Department of Transportation, such viaducts, tunnels, underpasses, or bridges are necessary for the safety of the general public and whereby a dangerous grade crossing is eliminated. The State Department of Transportation may appropriate out of the funds credited to the State Department of Transportation for the construction and maintenance of highways an amount not to exceed 50 percent of the cost to construct said viaducts, tunnels, underpasses, or bridges to the full extent of the width of the right-of-way and over the tracks as owned or operated by any railway in this state. If after due notice to a railroad that such a viaduct, tunnel, underpass, or bridge, in the judgment of the State Department of Transportation, is necessary to be built or constructed across the width of the right-of-way and over the tracks of the railway and such railway fails or refuses to comply with the order of the State Department of Transportation as provided in this section, the State Department of Transportation is empowered and authorized to forthwith build or construct such viaducts, tunnels, underpasses, or bridges, and the amounts so expended for such construction as provided in this section, shall constitute a charge against such railway and the State Department of Transportation shall render a bill to such railway stating the amounts expended and for what purpose; and upon the failure or refusal of such railway to make payment of the amount due the state, the State Department of Transportation shall forward all data and information to the Attorney General of this state, who shall immediately institute an action in the name of the State of Alabama, as provided by law, for the recovery of the amount as reported by the State Department of Transportation as due by the railway for the funds to be expended in the construction of viaducts, tunnels, underpasses, or bridges across the width of the right-of-way and over the tracks of such railway. Upon the recovery of such funds, the amount shall be paid into the State Treasury and credited to the account of the State Department of Transportation from which such funds were withdrawn; but said railway shall not be required to pay exceeding 50 percent of the cost thereof.
Ala. Code § 23-1-9 (1975)