They don't actually need to. They accept deposits for historical reasons and because they make money doing so, but there's nothing key to their business that requires them to do so.
Here's a decent summary, but I'll explain in great detail below.
By making loans, banks create money. This is what we mean when we say the
monetary supply is endogenous. (At least if you believe Sir Mervyn King, who used to run England's central bank...) The only real checks on this are regulatory--capitalization requirements and reserve requirements, which impose a sort of tax on a bank's circulating loans. I'll get into that later.
Let's start with
Why should you believe that story--that loans create deposits? It seems like a bizarre assertion. But it actually matches how banks behave in practice. If you go borrow money from a bank, the loan officer will do many things. She'll want to look at your credit history. She'll want to look at your income and assets. She'll want to look at what kind of collateral or guarantees you're providing that the loan will be repaid. What she will not do is call down to the vaults and make sure that there's enough bills stacked up for them to lend out. Loans are judged based on a profitability function determined by the interest rate and the loan risk. If those add up to "profitable", the bank makes the loan. So the limiting factor on the loans a bank makes are the available creditworthy borrowers--not the bank's stock of cash.
Further, the story makes sense because loans are how banks make money. If a bank that was short of money suddenly stopped making loans, it'd be screwed: no new loans = no way to make money to pay back depositors and also keep the lights on = no more bank.
And the story is believable because of the way banks make so little effort to solicit commercial deposit business. Oh sure, they used to give you a free toaster if you opened an account; but now it's really quite challenging to find a no-fee checking account that doesn't impose a super-high deposit limit. And the interest paid on savings deposits is asymptotically approaching zero. If banks actually needed your deposits, they'd be making a lot more of effort to get them. I mean, they won't turn up their noses; your deposited allowance is a couple basis points cheaper to the bank than borrowing from the Fed; but banks seem to value small-potatoes depositors more as a source of fees and sales opportunities for services and consumer credit than as a source of cash. (It's a bit different if you get north of seven figures, but smaller depositors aren't really worth the hassle just for their cash.)
What about fractional reserves and reserve ratios?
This is where someone will mention the regulatory requirements of fractional reserve banking: banks are obliged by regulators to keep enough cash on hand to pay out a certain percentage of deposits. Note nothing about loans was said in that statement: this requirement does not serve as a check on the bank making bad loans, because the bank is ultimately liable to all its depositors for the full value of their deposits; it's more making sure they have enough liquidity to prevent bank runs, the self-fulfilling prophecy in which an undercapitalized bank could be forced into bankruptcy. As you noted in your question, banks can always borrow from the Fed at the Fed Discount Rate (or from other banks at the interbank overnight rate, which is a little lower) to meet this requirement. They do have to pledge collateral, but loans themselves are collateral, so this doesn't present much of a problem.
In terms of paying off depositors if the bank should collapse (and minimizing the amount of FDIC insurance payout from the government), it's really capital requirements that are actually important. I.E. the bank has to have investors who don't have a right to be paid back and whose investment is on the hook if the bank goes belly-up. But that's just a safeguard for the depositors; it doesn't really have anything to do with loans other than that bad loans are the main reason a bank might go under.
The Technical Accounting
Banks, like any other private business, have assets (things of value) and liabilities (obligations to other people). But banking assets and liabilities are counterintuitive. The bank's assets are loans, because they are theoretically recoverable (the principal) and also generate a revenue stream (the interest payments). The money the bank holds in deposits is actually a liability, because it has to pay that money out to depositors on demand, and the deposited money will never (by itself) bring the bank any revenue at all. In fact, it's a drain, because the bank needs to pay interest to its depositors. (Well, they used to anyway.)
So what happens when a bank makes a loan? From a balance sheet perspective, strangely enough, the answer is nothing at all. If I grant you a loan, the minute we shake hands and you sign the paperwork, a teller types on a keyboard and money appears in your account. Your account with my bank. My bank has simultaneously created an asset (the loan you now have to repay me) and an equal-sized liability (the funds I loaned you, which are now deposited in your account). I'll make money on the deal, because the interest you owe me is a much higher rate than the interest I pay on your deposits, or the rate I'd have to pay if I need to borrow cash to cover your withdrawal. (I might just have the cash on hand anyway from interest and origination fees and whatnot from previous loans.)
From an accounting perspective, nothing has happened to my balance sheet, but suddenly you owe me closing costs and a stream of extraneous interest payments. (Nice work if you can get it...)
Okay, so I've exhaustively demonstrated that I don't need to take deposits to make loans. But we live in a world where banks do! Here's a few reasons:
- Historical inertia. Banks have always taken deposits, it's what the public expects. Also,
- It can be profitable. I can charge you for having too little money in your account, I can charge you exorbitant returned check fees, I can charge you interest on accidental overdrafts... and so on.
- It's a sales opportunity for other products to existing customers. Depositors are often borrowers. If I can sell you a mortgage, or better yet a credit card, I'm way ahead.
- It gives me customer information that might guide my future loaning behavior--if I know your direct deposit, your cash on hand, your monthly expenses, etc., I've got a lot more insight into what you can pay.
- Interbank account settling and reconciliation is a little easier if I have a lot of clients using me for financial services.
- Deposits are still cheaper than borrowing from the Fed, if marginally so. Not worth going out of my way for unless you're a big client who intends to park the money and not move it much, though, otherwise it's too volatile to be meaningfully predictable.
You can probably think of more, but at the end of the day, a bank should be designed so that if every single (non-borrowing) depositor withdrew their deposits, the bank wouldn't collapse or cease to exist.