Earlier this year, I noticed something curious: four Craigslist ads, selling the same brand of mattress, using nearly the same text, at the same location, but illustrated with different photographs. Let’s just say it doesn’t take a crack journalistic mind to suspect something odd was happening.

So this journalistic mind responded to all the ads. What I found was a story that went beyond mattresses in Minneapolis. More Americans are buying more stuff online, a trend driven partly by free and easy return policies. But as retailers sell more, they also end up with more items being sent back — creating a long, winding logistical trail that can very easily end up at the city dump.

The problem only gets more complicated when the thing being sold is a large, awkward block of heavy foam. Many, many online bed-in-a-box retailers have sprung up in recent years. The first of these companies popped up around 2010. Today, there are dozens of them, and as mattress-in-a-box companies proliferate like so many bedbugs, they’re finding themselves with a waste problem.

Part of what has made these companies successful is their return policies, said J. Andrew Petersen, a professor of marketing at Penn State University. In the early 2000s, his research demonstrated that returns weren’t necessarily bad for business. His work tracked sales data for a catalog clothing company over six years and found that as customers returned more items, they also purchased more — even as they also were receiving fewer of the company’s catalogs in the mail because of their return habits. There are limits to this, he told me, but in his studies, return rates as high as 13 percent were actually associated with higher profits.

These findings coincided with an easy-return era in online sales. That’s driven a massive growth in both direct-to-consumer sales and returns, said Paula Rosenblum, managing partner of Retail Systems Research, a market analysis firm. Between 2010 and 2015, returns across the U.S. and Canada increased by 66 percent, according to the U.S. Postal Service. But while shopping got more convenient, “returned” hasn’t always meant “resold.” When items come back to a retailer, they have to be sorted and repackaged, which costs money, and retailers might not be able to resell them at full price. “How much are you willing to pay for margins so slim?” Petersen said. The result: As much as 5 billion pounds of stuff just thrown out every year.

Which brings us back to my mattress adventure. Most mattress-in-a-box companies have offered free, simple returns during a long “try it out” period. If you don’t like the bed, you can return it and get your money back. Seems easy, so I tried it.

I had bought a mattress from a company called Tulo, but wanted to swap a medium-firmness model for a firm one. Which is how I found that, at least for this company, “returning” the unwanted mattress really just meant something more along the lines of “We’d prefer you donate it, but do what you want with it.” And this is the problem with lenient return policies for mattresses that arrive at customers’ house vacuum packed into a narrow tube. You can’t stuff this particular genie back into the bottle.

I ended up on Craigslist looking at mattresses because I wanted to know if I could resell mine. The four ads I found — for Purple brand mattresses at half their retail price — told me resale was possible. But something weird was going on.

At the other end of those eerily identical ads I found a single seller — an independent agent for a new kind of company that’s aiming to solve the mattress companies’ problems and reduce landfill waste. Called Sharetown, it works kind of like Uber and Lyft: A mattress company contracts with Sharetown to handle returns and, when one pops up, Sharetown connects the customer with an nearby agent who takes the mattress off their hands, cleans it up, and markets it for sale on local community sites like Facebook and Craigslist. When the mattress sells, everybody gets a cut — the agent, Sharetown and the company that originally sold the mattress.

Cody Hunter, founder and CEO of Sharetown, said it doesn’t compete with new sales because generally the people buying a used mattress aren’t the people who are willing to pay full price. He sees it more like allowing the company to reach customers they’d otherwise never be able to get. Sharetown has partnerships with multiple mattress companies, including Purple, Layla, Nest, Helix, Luma and Nature’s Sleep.

While clothing returns have driven growth in a secondhand industry that’s now big enough to be releasing market reports, mattresses have presented more complex logistics. The brands that work with Sharetown aren’t the only ones who’ve had to think outside the box. To make sure its unwanted mattresses go to charity, Tuft & Needle has developed an in-house logistics system and partners with a network of over 250 partner charities, said Melanie LaDue, the company’s giveback lead. When a customer wants to return a mattress, Tuft & Needle sets them up with one of those partners and only processes the refund after the customer uploads a picture of their donation receipt.

Ideally, this system runs smoothly, with mattresses being picked up for free and taken to people in need. But that’s not always the case, LaDue told me. “In California, a lot of charities can’t accept a used mattress,” she told me. “New York is another tricky area because charities aren’t willing or able to go into the city for pickup.” In those situations, all the company can do is encourage customers to donate to friends and family or, if all else fails, spend some of its own money to hire a waste removal company — which may mean at least part of the mattress will go to a landfill.

It’s not business as usual for retail sales companies to contract out to secondhand dealers or build a charity logistics arm, but avoiding the landfill takes more than just good intentions.

CORRECTION (Feb. 20, 2020, 11:40 a.m.): A previous version of this article inaccurately said that the online mattress sales were a $29 billion industry. That is a 2017 valuation of the entire mattress industry, not just the online sector. Online sales are now about 14 percent of the total domestic mattress market. Also, this article said online sales were worth 20 times as much in 2019 as they had been in 2014. That was an estimate of sales for six companies, not an industrywide measure. These statistics have been removed.