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 is entitled, and thereupon deposits in court, for plaintiff, the amount so tendered, and the allegation is found to be true, the plaintiff cannot recover costs but must pay costs to the defendant as well as the expenses and attorney’s fees.