It is true that people will continue to buy food and other necessities of life through good times and bad, but there can be some pretty significant shifts in how and where they do that buying. When times are good and there's room in the budget, places like Whole Foods (NYSE:WFM) and Fresh Market (NYSE:TFM) can draw in the traffic. Tough times, though, lead to tough decisions and can lead shoppers to consider trading down to the likes of Wal-Mart (NYSE:WMT) and the deep discount retailers collectively known as "dollar stores."

Investopedia Markets: Explore the best one-stop source for financial news, quotes and insights.

While that does indeed seem to be happening for Dollar General (NYSE:DG), the question is whether investors are already too far ahead of the story. Dollar General is indeed bringing people into the stores and management deserves credit for maintaining solid margins, but it looks like the valuation already presupposes a lot of that performance.

A Surprisingly Strong Second Quarter
One of the recent themes for retailers has been the push/pull between preserving margins (by raising prices) and preserving market share as input costs keep rising. Wal-Mart and Target (NYSE: TGT), for instance, have generally chosen to preserve margins and the result has been unimpressive same-store sales. Dollar General has generally been going the other way.

Improved pricing seems to be paying off - sales jumped more than 11% this quarter, with a nearly 6% increase in same-store sales, and the company beat the top end of its analyst estimate range. More impressive was the fact that Dollar General's gross margin erosion was minimal - just about 10 basis points from the year-ago level. The company maintained the good news through the rest of the income statement, as operating income rose 16% on a modest increase in operating margin and inventory per store rose a manageable 7%.

Can DG Keep This Up?
If Dollar General can somehow maintain this "best of both worlds" balance between solid same-store growth and stable margins, the other discount retailers need to be very worried. Dollar General has generally been inferior (at the gross margin level) to rivals like Dollar Tree (Nasdaq:DLTR), 99 Cents Only (NYSE:NDN), and Family Dollar (NYSE:FDO), but if the company can maintain these inventory turns, limit markdowns, and wring more efficiency out of its distribution system, then it frees the company to be very aggressive on price.

Time to Reap What They've Sown
Dollar General has been on a spending binge in recent years, taking on a big slug of debt about three years ago to fund a rapid store expansion during the worst of this recession (and sluggish recovery). That was a bold move, and now the company needs to show that they can reap the benefits of it. Stable margins, a growing top line and a slower pace of store expansion should allow the company to post improved free cash flow margins and generate the cash needed to pay down some of the debt.

Still, the company may be tempted to continue expanding. Growth by expansion can be hard to resist (it boosts revenue and gives management a larger fief) and Wall Street likely won't punish the shares so long as the revenue growth looks impressive.

The Bottom Line
While Dollar General does have a host of other deep-discount retailers to compete with, as well as discount food vendors like SUPERVALU (NSYE:SVU) and Aldi, Dollar General does have the advantage of competing mostly in smaller communities (where Aldi, for instance, is not so interested). Still, the company has to find that tricky balance between maintaining margins and market share and it doesn't look like cost pressure is going to ease soon.

Dollar General certainly has an opportunity to grow and build share, and maybe they will serve customers so well that they choose to stay with the store even as economic conditions improve. That said, the Street already expects quite a lot from this company and the stock is not much of a bargain itself. (For additional reading, take a look at Analyzing Retail Stocks.)

Use the Investopedia Stock Simulator to trade the stocks mentioned in this stock analysis, risk free!