Section 54A. If a city or town or any other person purchases any former railroad right-of-way in the commonwealth, no permit to build a structure of any kind on land so purchased shall be issued by any city or town in the commonwealth without first obtaining the consent, or a determination of inapplicability, in writing to the issuance of such permit from the secretary of the department of transportation. The department of transportation shall establish an application process, applicable timeframes and review guidelines that may require a public hearing component depending on when the former railroad right-of-way was last used by the railroad. As used in this section, the term ''former railroad right-of-way'' shall mean any property either formerly owned in fee by a railroad company and used as a railroad right-of-way or portion of any property formerly subject to an easement held by a railroad company and used as a railroad right-of-way. If said secretary does not consent to the issuance of such permit, the owner of the land may recover from the commonwealth such damages as would be awarded under the provisions of chapter seventy-nine.
Notwithstanding the provisions of the last sentence of the foregoing paragraph, there shall be no recovery from the commonwealth or the department in damages under said sentence by an owner of such land purchased after January 1, 1976.