Specifically, rates on money market accounts and time deposits increased by 79 basis points and 89 basis points, respectively, during the three months ended June 30, 2024, compared to the same period in 2023. The average balance of time deposits also increased, rising by $82.6 million, or 52.6%, to $518.1 million during the three months ended June 30 , 2024, compared to $435.4 million during the same period in 2023.
The overall average cost of deposits for the three months ended June 30, 2024 and 2023 was 1.69% and 1.10%, respectively. The average rate paid on all interest-bearing deposits increased by 76 basis points to 2.37% for the three months ended June 30, 2024, compared to 1.61% for the three months ended June 30, 2023. The average balance of interest-bearing deposits totaled $1.5 billion for both the three months ended June 30, 2024 and 2023. Meanwhile, the average balance of noninterest-bearing deposits decreased $57.1 million, or 8.4%, to $620.5 million for the three months ended June 30, 2024 compared to $677.5 million for the three months ended June 30, 3023 as customers sought to place excess funds in higher yielding deposit accounts.
Interest expense on borrowings remained relatively flat, increasing $11,000, or 1.00%, to $1.1 million for the three months ended June 30, 2024, compared to the three months ended June 30, 2023, due to a nine basis point increase in the average rate paid on junior subordinated debentures. The average cost of total borrowings increased to 6.18% for the three months ended June 30, 2024, compared to 6.09% for the three months ended June 30, 2023. The average balance of borrowings decreased $20,000 to $72.3 million during the three months ended June 30, 2024, compared to the three months ended June 30, 2023.
Interest expense increased $7.7 million, or 65.1%, to $19.4 million for the six months ended June 30, 2024, compared to $11.8 million for the six months ended June 30, 2023, reflecting higher funding costs primarily related to increased market rates of interest payable on money market and time deposits, as well as an increase in the average balance of time deposits. The average rate paid on interest-bearing liabilities for six months ended June 30, 2024 was 2.47%, compared to 1.60% for six months ended June 30, 2023. Total average interest-bearing liabilities increased $94.8 million, or 6.4%, to $1.6 billion for the six months ended June 30, 2024, compared to $1.5 billion for the six months ended June 30, 2023.
Interest expense on deposits increased $7.7 million, or 79.8%, to $17.2 million for the six months ended June 30, 2024, compared to $9.6 million for the six months ended June 30, 2023. The increase was driven by higher rates paid on money market accounts and time deposits and, to a lesser extent, an increase in the average balance of time deposits. Specifically, rates on money market accounts and time deposits increased by 91 basis points and 118 basis points, respectively, during the six months ended June 30, 2024, compared to the same period in 2023. The average balance of time deposits also increased, rising by $122.7 million, or 32.2%, to $503.4 million during the six months ended June 30 , 2024, compared to $380.7 million during the same period in 2023.
The overall average cost of deposits for the six months ended June 30, 2024 and 2023 was 1.62% and 0.91%, respectively. The average rate paid on all interest-bearing deposits increased by 92 basis points to 2.30% for the six months ended June 30, 2024, compared to 1.37% for the six months ended June 30, 2023. The average balance of interest-bearing deposits totaled $1.5 billion for the six months ended June 30, 2024, compared to $1.4 billion during the same period in 2023. Meanwhile, the average balance of noninterest-bearing deposits decreased $79.5 million, or 11.2%, to $630.0 million for the six months ended June 30, 2024 compared to $709.6 million for the six months ended June 30, 3023.
Interest expense on borrowings increased $23,000, or 1.00%, to $2.2 million for the six months ended June 30, 2024, compared to the six months ended June 30, 2023, due to a five basis point increase in the average rate paid on junior subordinated debentures. The average cost of total borrowings increased to 6.18% for the six months ended June 30, 2024, compared to 6.11% for the six months ended June 30, 2023. The average balance of borrowings decreased $335,000 to $72.3 million during the six months ended June 30, 2024, compared to $72.6 million during the three months ended June 30, 2023.
Net interest income and net interest margin. Net interest income decreased $2.0 million, or 8.1%, to $22.3 million for the three months ended June 30, 2024, compared to $24.3 million for the three months ended June 30, 2023. The decrease in net interest income primarily was due to an increase in interest expense on deposits and a decrease in interest income on loans, partially offset by increases in interest income on federal funds sold and interest-bearing balances in banks, interest income on investment securities and dividends on FHLB stock.