The court from which an execution or order of sale issues, upon notice and motion of the officer who makes the sale or of an interested party, may punish any purchaser of lands and tenements who fails to pay within thirty days of the confirmation of the sale the balance due on the purchase price of the lands and tenements by forfeiting the sale of the lands and tenements and returning any deposit paid in connection with the sale of the lands and tenements, by forfeiting any deposit paid in connection with the sale of the lands and tenements, as for contempt, or in any other manner the court considers appropriate. Upon motion, the court may order the return of any remaining portion of the deposit of the purchaser, less the costs of a subsequent sale and any other remedy the court considers appropriate. An order for contempt for failure of the purchaser to pay voids the confirmation of sale and transfer.