Inflation can erode a company's profitability, which is why in today's world, it's more important than ever for investors to pay attention to profit margins. If a company's profit margin is slim, then a surge in expenses can easily put its bottom line into the red.

Two companies with significant buffers on that front are BioNTech (BNTX -0.29%) and Public Storage (PSA -0.08%). Each has been banking 50 cents of every dollar it makes as profit.

1. BioNTech

BioNTech has been reporting strong sales and profit numbers thanks to the COVID-19 vaccine that it developed with Pfizer. Over the trailing 12 months, it has reported net income of 12.9 billion euros on revenue of 23.3 billion euros, for a profit margin of 55%. BioNTech could absorb some impact from inflation and still be at a margin of 50% or higher.

The caveat here is that the biotech company's margins could change, especially if demand for that vaccine, dubbed Comirnaty, wanes significantly. Comirnaty provides nearly all of the company's sales today. However, BioNTech has 20 clinical trials ongoing that are in either phase 1 or 2, including multiple mRNA-based therapeutics that treat various cancers. It will likely take years for those to obtain regulatory approval (assuming they do at all) and for BioNTech to generate revenue from them. But eventually, wins in those programs could give it a more diversified stream of revenues.

In the meantime, demand for COVID-19 vaccines isn't going away. Just last month, Pfizer and BioNTech announced that the U.S. government had signed a deal to purchase another 105 million vaccine doses, with the option to add a further 195 million. And with more contagious variants still emerging, demand for Comirnaty -- and for the modified version it has developed that targets the omicron variants -- should remain significant. Pfizer CEO Albert Bourla has stated in the past that people may need annual COVID-19 vaccinations, just as many now get annual flu shots.

The uncertainty ahead is a key reason why BioNTech's shares are trading at an incredibly cheap multiple of just three times earnings and why the stock is down 38% this year. (The S&P 500 has fallen by just 17%.) But with the healthcare company's financials looking sound, and likely to stay that way for the foreseeable future, this could be a solid bear-market buy right now.

2. Public Storage

Real estate investment trusts (REITs) generate good margins because their operations are relatively lean. They don't have a huge need for labor, nor do they require costly inputs to generate sales. That's why it shouldn't be a surprise that a company like Public Storage, which operates self-storage facilities, is one of the more profitable businesses out there. It has over 170 million square feet of rentable space across the U.S. and Europe.

Over its last four reported quarters, Public Storage's net income totaled $1.8 billion, which is half of the $3.6 billion in revenue that it generated during that period. What's even more impressive is that this year, the company expects to see comparable revenue growth of 12% to 15%, but it projects that expenses will rise by just 6% to 8%. In other words, Public Storage's financials aren't worsening despite the current economic conditions.

That should also give investors confidence in the dividend, which at the current share price yields 2.5% (compared to the S&P 500's average yield of 1.7%). Free cash flow of $2.4 billion in the trailing 12 months has been more than sufficient to cover dividend payments of $1.6 billion. And with continued growth, it may have even more of a buffer in the future

Trading at more than 30 times earnings, Public Storage isn't a deeply discounted stock like BioNTech is, but its business is looking strong and its premium valuation may be justifiable given how many companies are struggling right now. Down 15% year to date, it could make for a good buy on the dip.