If, in any action brought to recover the possession of lands sold for taxes by or against the purchaser or other person claiming under him, it is shown that the party claiming adversely to the tax title, being entitled to redeem, made within the time allowed for redemption the payment required by law for the redemption of such lands, or made tender thereof, and the amount of such tender has been paid into court for the opposite party, judgment must be rendered in his favor for the costs accruing after such payment or tender, except as against the state.