NIM increased 31 basis points to 4.54% for the three months ended September 30, 2022, from 4.23% for the same period in the prior year, and increased 28 basis points to 4.39% for the nine months ended September 30, 2022, from 4.11% for the nine months ended September 30, 2021. The increase in NIM between both the three and nine months ended September 30, 2022 and 2021, respectively, reflects new loan originations at higher market interest rates, variable rate interest-earning assets repricing higher following recent increases in market interest rates, and an improved asset mix of higher yielding assets as low yielding excess cash funded higher yielding loans.
The average total cost of funds, including noninterest-bearing checking, increased 20 basis points to 0.68% for the three months ended September 30, 2022, from 0.48% for the three months ended September 30, 2021. This increase was predominantly due to the rise in cost for market rate deposits and an increase in higher cost borrowings. The average cost of funds decreased three basis points to 0.50% for the nine months ended September 30, 2022, from 0.53% for the nine months ended September 30, 2021, partially due to runoff of higher cost retail CDs during the prior period, resulting in less interest expense this period. Management remains focused on matching deposit/liability duration with the duration of loans/assets where appropriate.
For the three and nine months ended September 30, 2022, the provision for credit losses on loans was $2.0 million and $4.5 million, respectively, compared to none and $1.5 million for the three and nine months ended September 30, 2021, respectively, as calculated under the prior incurred loss methodology. The provision for credit losses on loans reflects the increase in total loans receivable and increased reserves on individually evaluated nonaccrual commercial business loans.
For the three and nine months ended September 30, 2022, the (benefit) provision for credit losses on unfunded commitments was ($305,000) and $180,000, respectively, compared to provisions of $159,000 and $614,000, for the three and nine months ended September 30, 2021, respectively.
During the three months ended September 30, 2022, net charge-offs totaled $563,000, compared to $309,000 for the same period last year. The increase in net charge-offs was primarily due to a net charge-off increase of $373,000 in other consumer loans (which includes deposit overdraft net charge-offs of $396,000), partially offset by reductions in charge-offs of $99,000 in indirect home improvement loans and $19,000 in marine loans. Net charge-offs totaled $843,000 during the nine months ended September 30, 2022, compared to $747,000 during the nine months ended September 30, 2021. This increase was primarily due to a net charge-off increase of $325,000 in other consumer loans (which includes an increase in deposit overdraft net charge-offs of $333,000), partially offset by reductions in net charge-offs of $187,000 in indirect home improvement loans, $38,000 in commercial business loans, and $4,000 in marine loans.
Noninterest income decreased $4.2 million, to $4.2 million, for the three months ended September 30, 2022, from $8.4 million for the three months ended September 30, 2021. The decrease from the same period last year primarily reflects a $5.5 million decrease in gain on sale of loans due to a reduction in origination and sales volume of loans HFS and a reduction in gross margins of sold loans, partially offset by increases of $825,000 in other noninterest income primarily from bank owned life insurance (“BOLI”) death benefits and $438,000 in service charges and fee income as a result of less amortization of mortgage servicing rights reflecting increased market interest rates and increased servicing fees from non-portfolio serviced loans. Noninterest income decreased $15.2 million, to $14.4 million, for the nine months ended September 30, 2022, from $29.6 million for the nine months ended September 30, 2021. This decrease was primarily the result of a $17.6 million decrease in gain on sale of loans, partially offset by increases of $1.3 million in service charges and fee income and $1.2 million in other noninterest income due primarily to the same reasons as for the three-month comparison described above.