When land has been sold for taxes and purchased by anyone other than the state, and the purchase money has been paid into the state and county treasuries, and it shall be made to appear to the satisfaction of the Comptroller that such sale was invalid by reason of the fact that the taxes for which the land was sold were not due, the purchaser of said land, his heirs or assigns, upon the surrender of the certificate of purchase, shall be entitled to have the amount paid for the purchase of said land refunded to him, if application shall be made therefor as hereinafter provided, within two years from the date of sale and before the execution of a deed to such purchaser.