Firstly, banks do pay interest on deposits. The rest is quite complicated in reality.
Your reasoning is based on the idea of a simple textbook example of fractional reserve banking:
If a bank receives deposits, it can make loans, but needs to keep reserves. For the banking system as a whole, the minimum reserve requirement determines the maximum amount of money that could be created.
Essentially, when a bank provides a loan, the borrower receives the amount in the form of a deposit which leads to an increase in credits on the assets side and in customer deposits on the liabilities side of the bank’s balance sheet. Almost always, the borrowers will immediately use their new money to buy the goods or service for which the loan was taken. This payment reduces the deposits again.
It will increase the deposits on the payment recipient’s account, which more often than not will be at a different bank. In an even more extreme example, think of a USD 1000 loan to buy a mobile phone from a local dealer. If the person taken the loan withdraws the money in cash, and pays the local dealer in cash, and the local dealer decides to keep this cash, nothing else happens anymore. One important aspect is that an individual commercial bank cannot use the granting of loans to ensure a lasting increase in the deposits it holds. Therefore, you cannot simply compute a net earning on some fictional maximum amount of deposits, even if that simply textbook logic would be how banking works.
Leaving this simplistic model aside, deposits and loans are not related much in modern banking. In fact, many countries, including the US do not (or no longer) have any reserve requirements. However, banks have to adhere to numerous capital requirements (e.g. capital adequacy ratio computed as the percentage of a bank's capital to its risk-weighted assets), liquidity requirements (for example Net Stable funding ratio (NSFR) and Liquidity Coverage Ratio (LCR)) and reserve requirements. In essence, there is a whole set of requirements within the Basel III framework.
Lending does not automatically generate a profit because there will be defaults, changing interests rates and so forth. Sticking to the simple loans vs deposits example, loans are illiquid, long-term claims while deposits are liquid short-term liabilities. If you have a 10-year fixed rate loan for 1% in your books and interest rates increase such that deposits pay something like 5% in that 10 year period, you actually lose money as a bank.
You also do not need deposits for lending because you can issue bonds, get funds in the interbank market, via repos or by directly getting money from the central bank. For example, the ECB ceiling of potential refinancing operations now equals ~ €3.3 trillion according to the (T)LTRO tracker of the Universität Leipzig.