You get a special account from a bank called a warehouse that you pull your loans from. It's not an easy account to get. But you basically find a bank that can offer one (e.g https://www.usmetrobank.com/warehouse-lending/ - specifically for lenders offering mortgages). You agree to the terms you will lend the loans out, have collateral, etc.
Then you lend it out from there to customers based on the terms you agreed with the bank.