The economy is an enigma. Inflation is at a 40-year high, but the country added a whopping 528,000 jobs in July -- more than double the number predicted. Unemployment is extremely low at just 3.5%, and wages rose 5.2% year over year, offsetting some of the inflation effects. Are these macroeconomic contrarieties a buy signal or a sell signal?

If you are a long-term investor or seasoned money manager in the style of Warren Buffett, it's all just noise. Buying and holding stock in terrific companies is a sound strategy when the market is up -- and even better when the market is offering discounts.

Amazon (AMZN 0.23%) and RH (RH -0.54%) are two Berkshire Hathaway (BRK.A 0.55%) (BRK.B 0.50%) holdings that may interest investors. Let's take a look at why now might be a good time to buy these two stocks.

1. RH posts fantastic results in the face of headwinds

RH is a fascinating story. The company has come a country mile since its rebranding from Restoration Hardware. It has transformed from a discount retailer into a luxury brand with tremendous success. The stock has returned more than 800% since the beginning of 2017, even after falling 61% from highs set last August. 

Challenges abound lately, with the pandemic giving way to inflation, a technical recession, and plummeting consumer sentiment. With all of this, it would be easy to assume the company was struggling to make a profit. RH has posted record results instead.

Sales in fiscal Q1 2022 increased 11% year over year to $957 million, and adjusted net income rose 50% from the prior-year quarter to $213 million.

RJ Q1 revenue and net income figures over time

Data source: RH. Chart by author.

RH expects growth to cool for the remainder of 2022 as luxury homebuying slows. Sales will likely fall as the housing market adapts to rate increases, so this stock isn't for everyone. In the meantime, RH has added $2 billion to the share repurchase program to soften the blow. The company has a history of outperformance, and the stock's recent drop could be an opportunity for patient investors.

2. Amazon is a growth company again

When some were ready to count it out, Amazon came back to life. The company has quietly gone from a low-margin online retail giant to a fast-growing services company with higher-margin potential. The new figures are out, and Amazon Web Services (AWS) has maintained its stranglehold on the cloud computing market.

Chart showing cloud infrastructure market share, with Amazon accounting for 34%.

AWS grew sales 35% year over year in the first half of 2022 and will easily exceed $80 billion this year if the pace continues. Digital advertising is soaring as well, up 20% year over year to $16.6 billion through two quarters. Amazon faces serious retail headwinds, but savvy investors are salivating at the growth potential once again.

Both companies are facing headwinds that have brought the stocks back to Earth. Opportunity could be knocking for long-term investors.