Section 99. Cities and towns may make agreements with railroad corporations in regard to the kind of material, form of construction and payment of the cost of the wearing surface of bridges and approaches over or under a public way, wherever the railroad company is required by law to maintain such surface.