An agreement, referring to this section, contained in a recorded mortgage of real property, or in a recorded instrument relating to such mortgage, restricting the right or power, as against the holder of the mortgage without his consent, of the owner of the mortgaged real property to cancel, abridge or otherwise modify tenancies, subtenancies, leases or subleases of the mortgaged real property in existence at the time of the agreement, or to accept prepayments of instalments of rent to become due thereunder, shall become binding on a tenant or subtenant after written notice of such agreement, accompanied by a copy of the text thereof; and any such cancellation, abridgement, modification or prepayment made by such tenant or subtenant, after such written notice, without the consent of the holder of such mortgage, shall be voidable as against the holder, at his option. The recording on or after July first, nineteen hundred sixty, of any such mortgage or instrument relating thereto shall for the purposes of this section be in itself a sufficient notice of the restrictive agreement to any tenant or subtenant who, after such recording, acquires by assignment, whether the assignment is by instrument or by operation of law, a leasehold estate in existence at the time of the restrictive agreement. This section shall not apply (1) to any tenancy, subtenancy, lease or sublease primarily for the residential purposes of the owner of the leasehold estate, or (2) to any tenancy, subtenancy, lease or sublease having at the time of the restrictive agreement an unexpired term of less than five years.
N.Y. Real Prop. Law § 291-F