The debtor, permitted by the purchaser to remain in possession, shall not be liable for rent from the date of the sale to the time of the redemption; and if the purchaser or the purchaser’s assignee takes possession under the purchase, upon redemption by the debtor, the debtor shall have a credit for the fair rent of the premises during the time they were in the purchaser’s possession.