Some NYC sellers may agree to a mortgage contingency clause in the contract. The clause gives you the right to walk away with your deposit if you are unable to secure a mortgage commitment letter.
Because commitment letters have so many loopholes, many buyers’ attorneys ask for a funding contingency in addition to a mortgage contingency. A funding contingency frees you from the contract with your deposit if the bank fails to fund the loan for any reason except one that is your fault.
Unfortunately for buyers, sellers are unlikely to agree to any of the above unless the market is slow or they're having trouble selling.