Section 58. If a railroad constructed after April eighth, eighteen hundred and seventy-two, meets another railroad which terminates in the same city or town, or lawfully crosses another railroad at the same level therewith, the corporation by which either of said railroads is owned may enter its railroad upon, unite the same with and use the railroad of the other; if a railroad constructed after said date meets another railroad which passes through the same city or town, the corporation by which either of said railroads is owned may, with the written consent of the department and upon such terms as the department upon hearing prescribes, enter its railroad upon, unite the same with and use the railroad of the other; and if a railroad corporation whose railroad was constructed prior to said date is specially authorized to enter its railroad upon, unite the same with and use the railroad of another corporation, each of such corporations may enter upon, unite its railroad with and use the railroad of the other; but no locomotive engine or other motive power not owned and controlled by the corporation owning or lawfully operating the railroad shall be allowed to run upon a railroad except with the consent of such corporation.