§ 254-a. Right of election of mortgagee in certain cases. If a bond or note, or the mortgage on real property, improved by a one to six family residence occupied by the owner, securing the payment of same, contains (1) a provision whereby the mortgagee retains the right to accelerate the due date for payment of the balance of principal upon a transfer or sale of such real property or by alienation of title of such real property due to an act or operation of law, and (2) a provision for payment of any charge, however denominated, in the nature of a prepayment fee and if a mortgagor sells or transfers his property or if title to the mortgaged property is transferred by act or operation of law and the purchaser requests permission to assume the mortgage or take the mortgaged premises subject to the mortgage, but the mortgagee does not consent to such request and thereby necessitates prepayment of the mortgage, the mortgagee shall not levy a prepayment fee; provided, however, that the provisions of this section shall not apply to the extent such provisions are inconsistent with any federal law or regulation.