The challenges facing brick-and-mortar retailers today are multitude. Online shopping, led by, is taking share from traditional retailers. Mobile apps such as Groupon make it easy to find a deal, and many Americans have dropped out of the labor force following the worst recession since the Great Depression. From mall anchors like J.C. Penney and Sears to electronics retailers such as RadioShack and hhgregg, many retailers are closing locations, and some are fighting to survive. One corner of the industry is flourishing, however, moving in when others move out: dollar stores.

The three major chains -- Dollar General (NYSE:DG), Family Dollar (NYSE:FDO.DL), and Dollar Tree (NASDAQ:DLTR) -- are set to add a total of over 1,500 stores this year, growing their combined base by 6.3% to more than 25,000 stores, up from less than 5,000 in 1995. This expansion is nothing new. Over the past five years, the three companies added a total 5,595 stores, more than the number of U.S. Wal-Mart (NYSE:WMT) and Sam's Club locations combined.   Not surprisingly, the stocks of all three dollar store chains gained more than 150% in that time, as the chart below shows:

DG Chart

DG data by YCharts.

What's behind this surge
The easiest explanation for the rise in dollar stores is the most logical one. As the recession hit, consumers traded down to cheaper goods, favoring discount players such as Dollar General and its ilk. But the continued growth of dollar stores, even as the unemployment rate has approached the Federal Reserve's target of 6%, suggests that consumers are still in economic pain or that the stores are filling a void in the market.

The discount chains also benefit from certain macroeconomic factors, including that low-income Americans are less likely to shop online (according to a 2008 Pew Research survey). In fact, a 2013 research study completed by the National Telecommunications and information Administration along with the Economics and Statistics Administration and covered by The New York Times, found that "roughly 20% of American adults do not use the Internet at home, work and school, or by mobile device," and affordability was one of the largest concerns cited by non-Internet using households. , This seemingly gives the retailers a cushion against companies like Amazon, which can offer lower prices than brick-and-mortar options.The recent merger announcement that Dollar Tree intends to buy Family Dollar will likely spur a further expansion of the discount brands, and is evidence that investors (specifically Carl Icahn, who pushed for the deal), see more value and growth in the space. 

Wasn't this supposed to be Wal-Mart's territory?
While the recession may help explain the dollar store boom, not all discount retailers have benefited. For example, Wal-Mart, the world's largest retailer and the one most synonymous with "everyday low prices," has suffered. 

A Wal-Mart Neighborhood Market in Chicago. Source: Wal-Mart.

Though Wal-Mart has long owned the low-income shopper, as its rock-bottom prices and huge product selection ensure that you can find whatever you're looking for and get it cheap, dollar stores have one key advantage over that convenience.

While Wal-Mart superstores dominate rural America, growth in that area appears to have peaked, as same-store sales at domestic locations have dipped in each of the past five quarters. Those rural superstores are more vulnerable to the threat of online shopping, as consumers often have to travel a considerable distance to shop there, spending money on gas in the process.

The smaller-footprint dollar stores, meanwhile, are nimble enough to penetrate the inner cities and suburbs, where large tracts of real estate are hard to come by. Notably, the one segment that Wal-Mart has found success in lately is with its Neighborhood Market format, a smaller-footprint store that the company has been opening in densely populated areas of major cities such as Chicago and Atlanta. In its last quarter, comparable sales grew 5% at those stores, but fell nationwide. Both Wal-Mart and the dollar stores seem to know where the growth is coming from.

Income inequality ain't just a political term
The income inequality that has resulted from the recession isn't just an issue for lawmakers. It's changing the retail landscape. Middle-class retailers such as J.C. Penney are getting squeezed while those at the high and low ends have prospered. This idea, known as the consumer hourglass theory, was first identified in 2011 when consumer goods makers such as Procter & Gamble and Heinz began splitting product lines into high-end and low-end, and marketing them accordingly. P&G, for instance, introduced bargain-priced Gain dish soap as a result of the shift.. For chains such as Family Dollar and Dollar General, the widening gap between rich and poor Americans should continue to fuel growth. On the high end, luxury-goods makers like Tiffany, whose shares are up 130% in the last five years, have also thrived.

The latest challenge to Wal-Mart
The merger between Dollar Tree and Family Dollar is the most recent effort in the industry to take share from the world's biggest retailer, and it may also be the most formidable. The two companies expect the combination to eventually result in $300 million in annual cost savings, which will deliver increased profits for the new company, allow prices to be more competitive with Wal-Mart, and enable it to expand even faster. The deal, however, also represents a missed opportunity for Wal-Mart, which could have acquired Family Dollar, and could still submit a competing offer, though that seems unlikely. Acquiring Family Dollar would immediately add 7,500 stores to its base, many of which are in high-density areas that Wal-Mart is targeting and do not overlap with its current locations.

Wal-Mart, whose annual domestic sales are still several times greater than the dollar stores', will continue to be the model for the low-end retail industry, but when you're No. 1 you have a target on your back. Same-store sales have been slipping and the discount chains seem to be beating Wal-Mart to the punch in inner cities. With limited growth options available, this is one battle Wal-Mart can't afford to lose. 

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.