Section 7I. The department is hereby authorized to enter into agreements with railroad corporations, transit authorities or other public authorities or municipalities for the purpose of performing any work which may be necessary in connection with the construction of highways, roads, bridges and other public works undertaken by said department whenever such construction or work entails relocation, alteration or other work on the tracks, bridges, roads, pipes, sewers, conduits, wires, or other property of such railroad corporation, transit authority or other public authority or municipality and which may disrupt the free flow of public transportation. Whenever any such agreement provides that a railroad corporation, transit authority or other public authority, and municipality perform such construction or work for which the commonwealth is obligated to assume a part of the cost, the agreement may provide for the monthly advancement by the department to such railroad corporation transit authority or other public authority or municipality of funds covering the estimated cost of such construction or work then in progress.