If there was some provision in a rental application which allowed the realtor to keep a deposit, that provision would likely be enforceable as would be any other contractual provision. You should review the application to see what it says in this regard. As a more general matter: if a deposit is put down to hold an apartment for a prospective tenant, if the tenant ends up deciding to not rent, he or she generally gives up that deposit. Normally, it would go to the landlord or managing agent, but there is no reason why it could not go to the realtor, if that is what the realtor and landlord agreed.