Any owner or lessee turning over to his or its grantee, assignee, or to a purchaser of the leased premises at a foreclosure sale the amount of such security deposit, plus the tenant's portion of the interest or earnings accumulated thereon, is hereby relieved of and from liability to the tenant or licensee for the repayment thereof. Whether or not the deposit plus accumulated interest are so transferred, the grantee, assignee or purchaser of the leased premises is nevertheless responsible for the proper investment of the security deposit, giving all notices and paying interest pursuant to section 1 of P.L. 1967, c.265 (C.46:8-19) and for the return of the security deposit, plus any accumulated earnings or interest thereon, to the tenant or licensee, in accordance with the terms of the contract, lease, or agreement unless he or it shall thereafter and before the expiration of the term of the tenant's lease or licensee's agreement, transfer such security deposit to another, pursuant to section 2 of P.L. 1967, c.365 (C.46:8-20) and give the requisite notice in connection therewith as provided thereby.
N.J.S. § 46:8-21