Section 52. All expenses of, and incident to, constructing and maintaining any roadway or parkway crossing a railroad, as provided in the three preceding sections, shall be borne by the commonwealth, and shall be paid out of the funds available for use by the commission for boulevard or reservation purposes, unless otherwise determined by an agreement between the commission and any such railroad corporation.