The past few weeks have been rough ones for shareholders of retailer Dollar Tree (DLTR -0.20%). The stock is down 20% from its late-July peak, largely in response to a quarterly earnings miss and lackluster guidance, but also thanks to market-wide weakness.

It's not been all bad, though. There was and still is one upside to the underlying circumstances proving challenging for all consumers and corporations alike. The question: Is this particular upside enough to make the stock a buy?

The good news: Inflation is helping

Most investors understand the idea that Dollar Tree and its sister brand Family Dollar aim to offer low-frills value to cost-conscious consumers. What most investors may not fully appreciate, however, is just how big of a deal this strategy is right now. Against a backdrop of still-rampant inflation, even more affluent consumers are now shopping at bargain stores. As CEO Mike Wytinski commented during the second-quarter earnings call, "[W]e do have a lot of new customers coming into both banners over last year, and the majority of them are at a household income of $80,000 or higher."

The thing is, it's not just Dollar Tree seeing and pointing out such a shift. Rival Walmart is seeing the same. Its CEO, Doug McMillon, explained during the retailer's August earnings call, "[W]e're seeing more middle and higher-income shoppers choose us." Meanwhile, Target -- viewed as something of a premium name among general merchandise retailers -- saw its core customer base cut back during their visits to a Target store last quarter. They're reportedly curbing their discretionary spending due to higher costs of essential goods.

Given that August's inflation report released this week indicates price increases are still accelerating in many categories rather than decelerating (grocery prices are up more than 13% year over year), look for Dollar Tree's top line to continue growing much like it did last quarter. It was up a healthy 6.7% from year-ago levels and higher by 4.9% on a same-store basis.

The bad news: Inflation is also hurting

Inflation may be driving more -- and new -- customers to retailers that can provide more value. Dollar Tree's pricing power, however, isn't limitless.

This reality is indirectly evident in the revised guidance for the half-completed fiscal year. The company is now calling for revenue of between $27.85 billion to $28.10 billion versus consensus expectations of $28.16 billion following last quarter's top-line miss. Perhaps worse, its full-year per-share earnings forecast of between $7.10 and $7.40 is down from previous guidance for a fiscal 2022 bottom line of between $7.80 and $8.20 per share. Analysts had been looking for $8.19.

The company cites price cuts at its Family Dollar stores along with more consumer purchases of lower-margin "needs-based consumables" as key reasons for waning profitability. And maybe that's the case. The dialed-back earnings forecast ultimately shows the retailer can't pass along all of its own higher costs to consumers. That's particularly true of its Dollar Tree brand, which for marketing purposes self-limits its price point to $1.25 for most items it sells.

As long as the inflation that's turning affluent consumers into bargain hunters persists, Dollar Tree may find itself stuck between a rock and a hard place.

On balance

Don't read too much into Dollar Tree's headwind here. It's a tricky one to navigate, and it's taking a toll on profits. But the retailer is still on pace to improve its top line to the tune of 6%, though, with earnings set to grow 25%. The company can handle it -- it just won't be able to handle it nearly as well as its arch-rival, Dollar General (DG -0.40%).

Dollar General doesn't have to worry about operating two different discount-store brands, and it's also spent the past several years preparing for the situation consumers are currently facing in a way that Dollar Tree hasn't. Namely, Dollar General has developed a healthy private-label business with a handful of its owned-brand products receiving StoreBrands' Editors' Picks awards for 2022. The company has also made a point of introducing more fresh food and grocery products in its stores in recent years, many of which are offered at the highly marketable price point of $1. With more than 18,000 dedicated Dollar General locations versus 16,000 stores split between the Family Dollar and Dollar Tree banners, Dollar General simply has the scale and focus needed to make such price points viable.

It doesn't take a lot of reading between the lines to come to a wise conclusion. Dollar Tree is a tough name to justify stepping into at this time despite the stock's recent pullback. Its most notable rival is a much stronger pick.