Banks determine their lending interest rates based on the cost of borrowing, non-fund operating costs, margin for default risk, and desired profit margin. When they lend to risky borrowers, they determine their lending rates by combining risk-free interest rate and compensation for various risks.