If the tenant has a lease with sellers of a private property and the property is sold, an assessment of the rental should take place by the sellers (old landlord) and the security deposit settled at the time of sale, unless specific terms are delineated in the lease regarding what will happen if such property is sold. (any attorney would see to that) At which point the new owners can offer a new lease, new terms, and request a security deposit from the rental, or not. If there is no lease, technically the renter lives on a month by month basis.
I live in N.Y.C. and my response is generally the legal norm, however contact the local city administrators that deal with the ordinances where you live.