The Fed banks provide monetary policy and regulatory tools, and they can also provide directly to member banks and depository institutions.
The primary purpose of the Fed as a lender of last resort is to ensure the stability of the banks and the financial system.
Healthy banks are allowed to borrow all they want at very short maturities from the Fed’s discount window to prevent undue bank failures, and it is hence referred to as a standing lending facility.
Usually, on the overnight lending market, the banks prefer to borrow from one another. Some banks facing higher liquidity needs are at times unable to raise the necessary funds in the open market.
Fed discount lending serves as an emergency backstop once the interbank overnight lending system has been maxed out, it provides liquidity to such banks so as to prevent them from falling.
The interbank rate, which is also called the Fed funds rate, is lower than the discount rate.
Hence the commercial banks would prefer to borrow from another commercial bank instead of the Fed till the time the Fed funds rate is lower than the discount rate.
In most circumstances, this results in the total amount of discount lending being very small and intended only to be a fallback of liquidity for sound banks.