Section 97A. Notwithstanding any provision to the contrary of any general or special law, every company shall, before paying any claim for loss or damage to real property from any hazard, where the amount of the loss payable under the policy equals or exceeds five thousand dollars, first require the claimant to submit to the company a certificate of municipal liens from the collector of taxes of the city or town wherein such property is located.
Said company shall pay to the city or town any amounts shown on the certificate of municipal liens as outstanding on the date of loss and upon which interest is accruing as of the said date of loss, arising from the provisions of chapters forty, fifty-nine, sixty, eighty, eighty-three and section fifty-eight B to fifty-eight F, inclusive, of chapter one hundred and sixty-four to the extent of the amount of loss payable under the policy and a copy of said transaction shall be sent to the insured and mortgagees named on the policy.
The claim of the city or town for such amounts shall have priority over the claim of any insured owner, mortgagee, assignee or other interested party except where otherwise provided by the laws of the United States.
Said company shall not be liable to any insured owner, mortgagee, assignee, city or town, or other interested party for amounts disbursed to a city or town under this section or for amounts not disbursed to said city or town based upon a certificate indicating the nonexistence of any municipal liens.
The provisions of this section shall not apply to owner-occupied one, two, three or four family dwellings, provided, however, that the owners of said dwellings must be domiciled in said dwellings at the time the claim for loss or damage arose.