At any time not later than ten days before trial, any party against whom a cause of action based upon contract, express or implied, is asserted may serve upon the claimant a written offer to allow judgment to be taken against him for a sum therein specified, with costs then accrued, if the party against whom the claim is asserted fails in his defense. If within ten days thereafter the claimant serves a written notice that he accepts the offer, and damages are awarded to him on the trial, they shall be assessed in the sum specified in the offer. If the offer is not so accepted and the claimant fails to obtain a more favorable judgment, he shall pay the expenses necessarily incurred by the party against whom the claim is asserted, for trying the issue of damages from the time of the offer. The expenses shall be ascertained by the judge or referee before whom the case is tried. An offer under this rule shall not be made known to the jury.
N.Y. CPLR R3220