If any county treasurer shall, either directly or indirectly, be concerned in the purchase of any real property sold for the payment of taxes, he shall be liable to a penalty of not more than one thousand dollars to be recovered in an action in the district court brought in the name of the county against such treasurer and his bondsmen, and all such sales shall be void.