There is usually always an out for the dealership somewhere in the contract. Until the contract is sold to a lender, the vehicle still belongs to the dealership. The likely scenario was that the dealership couldn't get a lender to finance the loan with the specific terms. Obviously, if they can't sell the contract, they want their vehicle back.
It is the responsibility of the finance manager to determine what the lenders will approve based on your credit, etc.