If I can't get the loan I automatically get my deposits back.
The seller still needs to sign off for the buyer to get their deposits back, so it is not automatic.
While the contract does call for the buyer to get their deposits back if they can't get the loan, it is not always that easy.
If the seller feels anything was misrepresented, or if they feel the buyer purposely submitted something to not get the loan, they might request to keep some or all of the deposits.