Earlier this month, the better-than-expected consumer price index reading of 7.7% provided investors with a respite from the downturn in financial markets that has largely persisted throughout this year. But even after the rally that ensued following the release of this economic data, the S&P 500 index is still down 17% so far in 2022.

But by employing a long-term investing mindset, investors can use this market downturn to their advantage. I recently added to my positions in the home improvement retailer Home Depot (HD -0.57%) and the tobacco giant British American Tobacco (BTI -0.67%). Let's dig into the buy cases for both stocks.

1. Home Depot

With a $314 billion market capitalization, Home Depot is the dominant home improvement retailer on the planet. As dominant as Home Depot is within its space, however, investors may be shocked to learn that the company's retail share of the $900 billion U.S. home improvement market was just 15% in the prior fiscal year. For context, this was considerably greater than Lowe's 10% retail share.

The fragmented nature of the U.S. home improvement market means that Home Depot has the flexibility to execute bolt-on acquisitions to further strengthen its competitive positioning. This is one catalyst that should propel the company's net sales and earnings higher over time.

And with the professional contractor share of its business around 50%, Home Depot continues to win over the most lucrative customer base. Pros are the most desirable customer base because they spend more frequently and heavily than the do-it-yourself customer base, which pushes Home Depot's profit margin upward.

Down 27% off of its 52-week high, shares of the home improvement retailer have been hammered in 2022. This is because, with the 30-year mortgage rate around 7% and interest rates continuing to rise, home sales are expected to cool off. But even with this near-term headwind, analysts are anticipating 15.7% annual earnings growth from Home Depot over the next five years.

The stock's 2.5% dividend yield is materially above the S&P 500 index's 1.6% yield. And given that Home Depot's dividend payout ratio will come in under 46% for this fiscal year, the company should have the ability to keep hiking its dividend in the future. Best of all, shares of the stock can be scooped up at a forward price-to-earnings (P/E) ratio of 18.5. This is a reasonable premium compared to the S&P 500 home improvement retail industry average forward P/E ratio of 16.

2. British American Tobacco

Since its founding in 1902, the United Kingdom-based British American Tobacco has grown into a tobacco juggernaut. With over 52,000 employees in more than 175 markets around the world, the company is the second-largest tobacco company behind Philip Morris International (NYSE: PM).

British American Tobacco isn't your average tobacco company. With brands like Camel, Newport, and Pall Mall contributing to 88% of the company's total revenue, British American Tobacco is still mostly reliant on combustible cigarette brands.

But let's not forget about the company's noncombustible products, including leading brands such as the vape brand Vuse, heated tobacco brand Glo, and the oral tobacco brand Velo. These brands boast a collective customer base of 18 million. And by 2030, British American Tobacco believes that number will nearly triple to 50 million. This is why analysts are projecting the company will deliver 12.2% annual earnings growth for the next three years.

British American Tobacco offers income investors an outsized 7.7% dividend yield. Since the dividend payout ratio will come in at less than 62% over the next 12 months, this whopping yield also appears to be safe. And if a compelling mix of income and growth isn't enough for investors, British American Tobacco is also cheap. The stock's forward P/E ratio of 9.3 is meaningfully below the S&P 500 tobacco industry average forward P/E ratio of 12.5.