Dollar stores can trace their roots to the mid-1800s, when one-price stores became a popular way to sell clothing, jewelry and knickknacks to thrifty shoppers, said Wendy Woloson, an associate professor of history at Rutgers University. Back then, there were also 25-cent and 49-cent stores. Frank Winfield Woolworth, the founder of F.W. Woolworth Company, later built a chain of five-and-dime stores, starting with a Great Five Cent Store in Utica, N.Y.

Today, many dollar stores offer steep discounts by selling leftovers from other retail outlets. But as the stores have evolved, they have also expanded their inventory with bigger chains carrying their own brands and many stores adding perishable foods. Dollar Store Services, a developer of 3,000 independent dollar stores nationally since 1992, recently introduced a model for urban neighborhoods that is part dollar store, part bodega.

These no-frills stores have become a refuge for people left behind by the economic recovery, including laid-off workers, middle-class families facing rising living costs and recent college graduates burdened by huge loans. “A lot of customers who traded down to dollar stores can’t trade back up, or see no need, because the dollar stores meet their needs,” said Mark A. Cohen, an adjunct professor and director of retail studies at Columbia Business School. “To them, Walmart is a luxury store.”

Lassina Sanogo, 40, a security guard from the Bronx who earns $30,000 annually, said he always bought his cleaning supplies from a dollar store. “I can’t afford to lose a dollar,” he said. “And what I used to get for a dollar, now that’s up to two dollars.”

There is no official tally of New York City’s dollar stores. But there were 1,247 variety stores, including dollar stores, in 2015, a 24 percent increase from 1,002 stores in 2005, according to an analysis of census data by Queens College. Brooklyn had the largest number of stores, with 469, followed by Queens, with 355, and the Bronx, with 224.

Though national chains of such stores once largely stayed out of New York City, deterred by the high costs of doing business, they are increasingly moving in. There are 174 dollar and discounted general merchandise stores operated by major chains, including Dollar Tree, up from 139 such stores five years ago, according to Chain Store Guide, a research firm.