Over the last few months, shares of all of Canada’s banks haven’t been great performers.

Take Canadian Imperial Bank of Commerce (TSX:CM)(NYSE:CM) as an example. Back in April, shares were close to $98 each. But even after delivering some solid first-quarter earnings, shares have fallen approximately 8% to $92, where they trade today.

On the surface, this looks like a great opportunity to pick up some cheap bank shares. CIBC trades at a price-to-earnings ratio of just 10.5, which is among the lowest in the Canadian banking sector. It also pays a handsome 4.7% dividend yield, which has been increased over each of the last two quarters.

But beneath these numbers are some serious risks. Let’s take a closer look at the bank and see whether it has a place in your portfolio.

The bull case

It isn’t just the P/E ratio and the dividend yield telling you to buy CIBC shares.

Canada’s banks are among the best in the world. Over the years the so-called Big Five have delivered consistent profit growth and dividend increases, and all without anything but minor hiccups. Yes, 2008-09 was a tough time, but Canada avoided the meltdowns that were common south of the border.

CIBC has been around since the year after Canada became a country, opening its doors in 1868. It paid its first dividend to shareholders later that year and hasn’t missed one since. That’s nearly 150 years of uninterrupted payments to shareholders.

As much as some of Canada’s larger banks get more attention, CIBC is just as good of an operator. Yes, it did recently lose half of the coveted Aeroplan Visa portfolio to a competitor, but it has responded by partnering up with Tim Hortons with a branded Visa card. And it’s obvious that losing those customers didn’t do much to the bottom line, since the company recently posted terrific quarterly earnings.

The company has also been focused on expanding its wealth management business. Although it hasn’t made a big acquisition in the space since 2013, rumours are swirling that management is keen to expand in that sector, especially considering new CEO Victor Dodig’s previous history in the business. Anything that diversifies earnings away from its Canadian retail operations is a good thing.

Additionally, the company’s decision to exit the mortgage broker channel and bring its loans completely in house has been a good one. It has led to higher interest margins and better control of the product.

The bear case 

There’s one simple reason why CIBC is Canada’s cheapest bank, at least from a P/E and dividend-yield perspective. It’s viewed as the most exposed bank to Canadian housing.

Over the last 12 months approximately 70% of the company’s net income has come from its Canadian retail division. When times are good, there’s nothing wrong with that. Canadians are spending and borrowing more than ever, which is good news for our banks.

But there are cracks beginning to appear in the Canadian economy. It’s pretty much universally accepted that Canada has slipped into a recession as lower commodity prices and a weak dollar have taken a bite out of growth.

What’s interesting is just how bad the damage could get. If this recession is also the stimulus that starts to bring down the housing market, it could get really interesting for Canada’s banks. Since CIBC has the highest exposure to the Canadian consumer, the market is valuing it as the riskiest bank. Each of Canada’s other major banks—with the exception of National Bank of Canada—have significant foreign operations to help ease the pain of a major downturn in Canada.

The story of CIBC is simple. If Canada manages to avoid a major housing downturn, shares are probably a bargain at today’s levels. But if the price of real estate heads lower, so will CIBC shares. It boils down to a bet on Canadian housing. Personally, I wouldn’t want to make that bet, no matter how good the underlying fundamentals are.

Curious about Canada's banks? You won't want to miss our latest report!

Canadian banks are considered must-have investments. After all, they're very stable, well capitalized, and face limited competition. That said, there are concerns for the banks and their investors. In this FREE report, we cover everything you need to know about Canada's Big Five--whether you're already an investor or are considering buying shares. Simply click here to receive your special FREE report, "What Every Bank Shareholder MUST Know."

NEW! This Stock Could Be Like Buying Amazon In 1997

For only the 5th time in over 14 years, Motley Fool co-founder David Gardner just issued a Buy Recommendation on this recent Canadian IPO.

Stock Advisor Canada’s Chief Investment Adviser, Iain Butler, also recommended this company back in March – and it’s already up a whopping 57%!

Enter your email address below to claim your copy of this brand new report, “Breakthrough IPO Receives Rare Endorsement.”

Fool contributor Nelson Smith has no position in any stocks mentioned. The Motley Fool owns shares of Visa.