In the case of a tenant whose right of possession is not paramount to that of the purchaser at a sheriff's or other judicial sale, the latter shall have the right as a landlord to collect by assumpsit or to distrain for rent from the date of the acknowledgment of his deed, except for such fractional part of a quarter as the tenant, if a farmer or one engaged in raising crops or produce, or such fractional part of a month in other cases, as the tenant may, in accordance with the terms of his letting, have paid as an advance payment prior to the date of the acknowledgment of said deed. In the case of a tenant whose right of possession is paramount to that of such purchaser, advance rent paid prior to the date of acknowledgment of the purchaser's deed shall be deemed properly paid though paid prior to its due date, unless it is so paid with the actual notice of the pendency of the proceedings resulting in the sale or with intent to defeat the rights of a purchaser thereat.
The right of possession of a tenant for years shall not be deemed paramount to that of a purchaser at a tax sale.
The right of possession of a tenant shall be deemed paramount to that of a purchaser at a judicial sale if and only if the letting to him shall precede in point of date the entry of the judgment, order or decree on which such sale was had and also shall precede the recording or registering of the mortgage, deed or will, if any, through which by legal proceedings the purchaser derives title, and shall not be paramount if the letting is made with actual notice to such tenant of the contemplated entry of such judgment, order or decree or of the fact of the execution of such mortgage, deed or other instrument of writing and with intent to avoid the effect thereof.
68 P.S. § 250.304