When, in an action for the recovery of money only, the defendant alleges in his answer that before the commencement of the action he tendered to the plaintiff the full amount to which he was entitled, and thereupon deposits in court, for plaintiff, the amount so tendered, and the allegation is found to be true, the plaintiff can not recover costs, but must pay costs to the defendant.