A bear market is a great time to invest in good companies that have been unfairly punished by panicking investors. Some of the best deals you'll ever see are during double-digit stock market declines.

But investors must be very careful to avoid buying stocks that have been punished for good reasons. Some companies may look like high-quality operations during the best of times, earning sky-high valuations, only to be exposed as disasters when a bear market lifts the veil.

Online furniture retailer Wayfair (W 5.52%) and oat milk pioneer Oatly (OTLY 0.97%) seem to fall into this category. With pandemic tailwinds gone and the economy barreling toward a recession, a comeback for these stocks looks like a pipe dream.

Wayfair

It took trillions of dollars in stimulus and a global pandemic that forced people to spend much more time at home for online furniture seller Wayfair to turn a profit. And even then, profits were far from impressive. The company managed net income of $185 million on $14.1 billion of revenue in 2020, good for a meager profit margin just above 1%.

If a business only works when absolutely everything is going right, then it doesn't work at all. Wayfair now finds itself in the exact opposite environment. Demand has plunged, inflation is leading people to think hard about their purchases, and costs are soaring. Wayfair is back to losing money hand over fist.

Revenue tumbled nearly 15% in the second quarter, and the company reported a net loss of $378 million and a free cash flow loss of $244 million. Wayfair doesn't hold any meaningful inventory, which is a good thing since many retailers are overloaded with merchandise. Unfortunately, that means it's competing with retailers that are discounting products heavily.

Shares of Wayfair now trade right around the panic levels of early 2020, down around 91% from their all-time high. That may still be too expensive. The company is valued at roughly $3.2 billion, despite losing more than $2.6 billion cumulatively over its lifetime. Its only profitable year was a once-in-a-century anomaly, and the balance sheet has $3 billion of debt and a cash balance that's being lit on fire as demand implodes.

If Wayfair survives the current downturn, the odds it will reclaim its pandemic-era highs anytime soon look remote.

Oatly

While non-dairy milk substitutes aren't going anywhere, the industry has gone through multiple iterations. Soy milk was once the leader, then came almond milk, and now oat milk is surging in popularity.

For a while during the pandemic, Oatly was having trouble keeping up with demand for oat milk. The company laid grand plans to greatly increase its production capacity, expecting to spend as much as $400 million this year on capital spending. But then demand started to weaken, and the company slashed those spending plans.

Oatly has three big problems. First, oat milk is probably not the be-all and end-all of the alternative milk market. Like every other type of alternative milk that became popular before it, something will eventually take its place. Second, oat milk is probably a commodity, or close to it. There are many brands, including inexpensive store brands, that are eating away at Oatly's market share. Third, Oatly struggled to turn a profit even when everything was going right. How a company loses money selling oats, vegetable oil, and water for far higher prices than real dairy is truly a mystery.

Oatly's revenue is still growing, but gross margin collapsed to just 16% in the second quarter, and the company posted a net loss of $72 million on $178 million of revenue. The demand that Oatly envisioned just isn't materializing.

Oatly stock is down 91% from its all-time high, although the company is still valued at $1.5 billion. While Oatly expects to reach a gross margin in excess of 40% over the long run, that goal seems pretty farfetched. The dairy business is a low-margin affair, and I see no reason why the alternative dairy business should be much different.

Even if oat milk continues to grow in popularity, competition seems likely to eat Oatly alive.