Section 9. Any bank or federally-chartered bank may establish an account to receive deposits from a lessor acting as a trustee for funds received and held by such trustee pursuant to paragraph (a) of subsection (3) of section 15B of chapter 186. Such account may be established as required by said section 15B for the purpose of holding security deposits taken by a lessor of residential dwelling units owned or managed by said lessor; provided, that the terms of said account shall place said deposit beyond the claim of a creditor of the lessor, including a foreclosing mortgagee or trustee in bankruptcy, and shall provide for the transfer of said deposit to a subsequent owner of any property for which such security deposit was taken. Interest accruing on said deposit shall be paid to the lessor pursuant to the terms of the deposit. Withdrawals and payments made by the corporation from said account shall discharge the liability of said corporation to all persons.