No sheriff or deputy or other officer discharging a similar duty shall be permitted to purchase any property whatever at his own sale, either upon his own bid or upon the bid of any other person for him, directly or indirectly. All such sales and deeds in pursuance thereto, intended to vest in such officer the title to the property so purchased, shall be null and void.