It doesn’t have to be written into the buyers agreement at all.
Per BBB Upstate NY website:
Many consumers are under the false impression that there is a law which entitles them to a refund made on a car deposit if they choose not to buy the car.
There is no such law.
Car deposits are non-refundable, unless the contract or sales receipt specifically contains a refund policy.
Before signing on the dotted line or making a deposit, inquire what the dealership’s policy is. If the contract does not contain a refund policy on car deposits, you may request one be written in the contract, or be written on an addendum attached to the contract.