An owner of federally assisted housing who prepays the mortgage or loan or whose rental assistance contract expires and who continues to operate the property as residential housing within the scope of this chapter shall not evict a tenant residing in the dwelling unit when the mortgage or loan is prepaid or the rental assistance contract expires, except as authorized by the federal assistance program applicable to the project prior to prepayment of the mortgage or loan, or expiration of the rental assistance contract.