Praise be to Allah.
If the purchase contract was made, and the purchaser made the down payment on the basis that he would go ahead with the purchase, and if he did not then the down payment would be kept by the seller, that is valid. It is called a sale in which a down payment is stipulated.
It says in al-Mubdi‘ (4/58): A sale in which a down payment is stipulated is where someone buys something for a defined price, and gives the seller one dirham or more [as a down payment], then if he goes ahead with the purchase, that amount is deducted from the price, otherwise – if he does not go ahead with the purchase – that money belongs to the seller. Ahmad said: That is valid, because ‘Umar did that. Naafi‘ ibn ‘Abd al-Haarith narrated that he bought a house to be a prison for ‘Umar from Safwaan, on the basis that if ‘Umar approved of that, he would go ahead with the purchase, otherwise Safwaan would keep such and such [the down payment]. End quote.
If the purchaser cancels the deal, and the seller keeps the down payment, and the seller is actually a group of people, then they should divide the deposit according to their shares in the property. If they all have equal shares, then the money is to be shared equally. If one of them owns half, for example, then he takes half of the down payment, and so on.
This is what was determined by the fuqaha’ concerning similar cases, such as if the land produces a harvest, then it is to be shared [among the owners] commensurate with their shares of ownership; or, if one of them wants to sell his share, the others have the right of first refusal, each commensurate with his share; or if people who have shared ownership of land rent out their shared land, then the rent they receive is to be shared out among them, commensurate with their shares.
It says in Mataalib Ooli an-Nuha (4/120): The right of first refusal is given to partners commensurate with their shares, because the right of first refusal is a right that is earned because of ownership, so it is to be shared commensurate with each person’s share of ownership, like the harvest of the land. End quote.
It says in Sharh al-Muntaha (3/550): None of the owners can keep the rent to himself, because the rent is for all of the owners, commensurate with the share of each of them. End quote.
And Allah knows best.