Interest rates are rising, and mortgage rates have gone along for the ride. According to Freddie Mac, for the week of July 12, 2012, the average rate on a U.S. 30-year fixed-rate mortgage was 3.56%. Freddie's report for this past week showed that the rate had jumped to 4.51%.

Earnings reports from Wells Fargo (WFC -1.11%) and JPMorgan Chase (JPM 0.15%) on Friday visibly showed the downside of the rising-rate environment. As rates rise, the refinancing boom has slowed, and that's damping the mortgage-origination fees that these mortgage giants collect. At the same time, rising rates are hurting the banks' securities portfolios. During the first quarter, on a pre-tax basis, Wells Fargo had north of $6 billion in unrealized investment losses.

But it's not all bad news. In recent quarters, a pain point for banks has been declining net interest margins -- i.e., the spread between loan income and borrowing costs that they keep as profit. As rates rise, that could start to reverse. And if we see a continuation of the following chart, it could reverse dramatically.

In this chart you can identify the 30-year fixed mortgage-rate line by looking for the one that's spiking dramatically. The other two lines represent changes in the rates paid on money market accounts and five-year CDs. What we're seeing is mortgage rates jumping while the rates paid out remain relatively flat. That suggests the potential for a big jump in spread income.

And while many of us may think of banking deposits as interest-free checking accounts that cost a bank nothing (in interest at least), banks are heavily funded by interest-bearing accounts such as money markets and CDs. At the end of last quarter, Bank of America (BAC -1.07%), for instance, had $662 billion in interest-bearing deposits -- largely money market type accounts -- versus $358 billion in non-interest-bearing deposits. At US Bancorp (USB -1.49%), it breaks down to $149 billion interest-bearing and $68 billion non-interest-bearing.

To be sure, the rising rate environment will continue to present challenges, but if you're a banker, or a bank investor, this is the kind of thing that should make you smile.