The stock market finished the week on a record note, bouncing back from big losses the previous week. The S&P 500 (^GSPC 1.02%) closed at an all-time high, and similarly sized gains of 0.5% to 1% for the Dow Jones Industrial Average (^DJI 0.40%) and Nasdaq Composite (^IXIC 2.02%) showed a level of confidence that's noteworthy amid plenty of macroeconomic uncertainty.

Index

Daily Percentage Change

Daily Point Change

Dow

+0.60%

+216

S&P 500

+0.95%

+45

Nasdaq

+0.73%

+113

Data source: Yahoo! Finance.

Investors might have thought that the stock market would do poorly after Friday morning's announcement from the Bureau of Labor Statistics (BLS) that consumer inflation  levels had reached multi-decade highs. However, Wall Street shrugged off that news, and in fact, a couple of stocks actually seemed to benefit from it. Below, we'll talk more about those companies, but first, let's look at exactly how bad the inflation numbers were.

Higher prices all around

The news from the BLS on inflation was worse than expected. The Consumer Price Index (CPI) rose 0.8% in November, marking the fourth time in the past eight months that the CPI had risen that much or more in a single month. That brought the 12-month rise in price levels consumers pay to 6.8%, which was the largest 12-month increase in nearly 40 years. Indeed, you have to go back to the oil shocks of the 1970s and early 1980s to see inflation at such persistently high levels.

Gains were widespread across many categories. Energy prices were up 3.5%, with gasoline prices climbing more than 6% in a single month. Food prices were higher by 0.7%. Some other items that have seen stubborn high price increases stayed near the top of the list, with new vehicle prices picking up 1.1%, used car prices climbing 2.5%, and apparel seeing 1.3% price gains .

People standing around a drivetrain.

Image source: Getty Images.

Pricing power for the win

Inflation isn't necessarily bad for everyone. Those on fixed incomes get hurt when the purchasing power of their money falls, but those whose wages rise along with inflation can keep up. Similarly, companies that have to bear higher input costs themselves see profits suffer, but those that can pass on higher costs to consumers can avoid or at least reduce the hit to their earnings.

For instance, Costco Wholesale (COST 1.01%) saw its stock rise nearly 7% on Friday. Those gains stemmed initially from the warehouse retailer's fiscal first-quarter financial report late Thursday, which indicated extremely strong consumer demand even at heightened price levels.

Comparable sales were up 15% from year-earlier levels, and while a significant portion of those gains were due to higher gasoline prices, Costco still saw a nearly 10% rise in comps after accounting for gasoline and foreign exchange effects. Earnings of $2.98 per share were up 14% year over year, showing that Costco seems to be passing through any heightened costs of goods sold to its members.

Similarly, Ford Motor (F -1.92%) shares climbed almost 10%. Investors responded favorably to news that executive chair and family scion Bill Ford spent more than $20 million to exercise stock options awarded as compensation, and rather than immediately selling the shares at a profit, he apparently chose to hold onto them.

That vote of confidence comes amid Ford's ongoing efforts to overcome challenges from semiconductor chip shortages to meet the huge and rising demand for cars and trucks. Moreover, Ford's transition to electric vehicles is gaining momentum, with customers clamoring for the coming F-150 Lightning electric pickup truck.

You can beat inflation

Inflation hurts consumers, but it can be good for the right stocks. By identifying companies that can take advantage of inflationary conditions, you can potentially benefit from elevated prices and maintain the purchasing power of your investment portfolio.