were principal balances of $1.2 million in loans to small businesses under this program, compared to $7.0 million at December 31, 2021.
Comparison of Operating Results for the Three Months Ended March 31, 2022 and 2021
General. Net income for the three months ended March 31, 2022 was $50.1 million, a decrease of $11.8 million, or 19%, from net income of $62.0 million for the three months ended March 31, 2021. The decrease was primarily due to a $9.4 million, or 21%, decrease in noninterest income that reflected a 37% decrease in gain on sale of loans. Also contributing to the lower net income was a $6.2 million, or 9%, decrease in net interest income that reflected a 4% decrease in interest income that reflected lower loan balances.
Net Interest Income. Net interest income decreased $6.2 million, or 9%, to $65.7 million for the three months ended March 31, 2022, compared with the three months ended March 31, 2021. The decrease was due to a 4% decrease in interest income from lower average loan balances. The interest rate spread of 2.55% for the three months ended March 31, 2022 decreased 38 basis points compared to 2.93% for the three months ended March 31, 2021.
Our net interest margin decreased 37 basis points, to 2.62%, for the three months ended March 31, 2022 from 2.99% for the three months ended March 31, 2021. The decrease in net interest margin reflected lower average loan balances at lower average yields, higher average cash balances, and higher average deposit balances at higher yields.
Interest Income. Interest income decreased $3.5 million, or 4%, to $76.0 million for the three months ended March 31, 2022, compared with the three months ended March 31, 2021. This decrease was primarily attributable to a decrease in average loan balances and slightly lower average yields.
The average balance of loans, including loans held for sale, during the three months ended March 31, 2022 decreased $329.4 million, or 4%, to $8.0 billion compared to the three months ended March 31, 2021, while the average yield on loans decreased 2 basis points, to 3.64%, for the three months ended March 31, 2022, compared to 3.66% for the three months ended March 31, 2021. The decrease in average balances of loans and loans held for sale was primarily due to warehouse volumes declining during the period.
The average balance of mortgage loans in process of securitization decreased $151.2 million, or 30%, to $349.0 million for the three months ended March 31, 2022, compared to $500.2 million for the three months ended March 31, 2021, while the average yield increased 7 basis points to 2.61% for the three months ended March 31, 2022.
The average balance of interest-earning deposits and other increased $849.6 million, or 139%, to $1.5 billion for the three months ended March 31, 2022 from $610.9 million for the three months ended March 31, 2021, while the average yield decreased 11 basis points, to 0.24%, for the three months ended March 31, 2022.
Interest Expense. Total interest expense increased $2.7 million, or 36%, to $10.3 million for the three months ended March 31, 2022, compared with the three months ended March 31, 2021.
Interest expense on deposits increased $2.7 million, or 44%, to $8.8 million for the three months ended March 31, 2022 from the three months ended March 31, 2021. The increase was primarily due to increases in average balances of money market accounts and certificates of deposits, which was partially offset by lower average rates for certificates of deposit. The average balance of certificates of deposits of $1.1 billion for the three months ended March 31, 2022 increased $664.0 million, or 159%, compared to the three months ended March 31, 2021. The average yield of certificates of deposits was 0.50% for the three months ended March 31, 2022, which was a 59 basis point decrease compared to 1.09% for the three months ended March 31, 2021. The average balance of money market accounts of $2.7 billion for the three months ended March 31, 2022 increased $645.7 million, or 31%, compared to the three months ended March 31, 2021. The average yield of money market accounts was 0.79% for the three months ended March 31, 2022, which was a 6 basis point increase compared to 0.73% for the three months ended March 31, 2021.