This year has been one in which many investors have been flocking to safe stocks, including ones that pay dividends. As a result, many normally safe stocks that generate only modest gains have been producing oversized returns for investors.

Three stocks that have dwarfed the S&P 500 this year and that are up over 20% and also pay a high rate of dividends include Merck (MRK 2.24%), General Mills (GIS -0.49%), and Chevron (CVX -0.45%). I'll take a closer look at why these stocks are doing so well and whether they're still good buys today.

1. Merck

Merck has been a high-flying healthcare stock this year as its shares are up over 40% thus far. The business has been doing well. In Merck's third-quarter earnings, the company reported sales of just under $15 billion for the period ended Sept. 30, which rose 14% year over year. Top-selling cancer drug Keytruda led the way at $5.4 billion in sales, which were up 20% from the prior-year period.

The company's resiliency at a time when many businesses have been struggling has undoubtedly attracted many investors' attention. In October, the company also announced it was exercising an option to work on a personalized cancer vaccine with Moderna, in a move that likely got investors excited about its future growth prospects. 

Even with the increase in value this year, Merck's dividend still yields 2.7%, which is a full percentage point higher than the S&P 500 average of 1.7%. At 18 times earnings, the stock is still cheap compared to the average healthcare stock, which trades at 23 times profits. 

Although it's trading around its 52-week high, Merck remains a solid buy for both dividend and growth-oriented investors.

2. General Mills

General Mills' stock is up 28% this year, which is an impressive performance for a stock that usually doesn't give investors much of a reason to invest in it besides its dividend. But the cereal maker, known for brands such as Cheerios, Cinnamon Toast Crunch, and Cocoa Puffs, has been a popular place to invest in amid inflation.

Its products are staples in households, and even rising prices haven't been enough to derail the company's performance this year. For the period ending Aug. 28, General Mills' reported net sales of $4.7 billion, which rose 4% year over year. The company also raised its guidance, projecting organic net sales to rise between 6% and 7% for fiscal 2023 (its year ends in May).

The stock yields 2.6%; this, too, is another above-average payout for investors to collect. Trading at 18 times earnings, General Mills' multiple is a bit cheaper than the S&P 500 average of 20. With some great stability and a high yield, the consumer goods stock also looks like a good buy heading into next year.

3. Chevron

Chevron's stock is up 50% this year, representing the best return on this list. It's little mystery as to why the oil and gas giant is doing so well as commodity prices have soared this year to levels they haven't been at in several years. And while oil prices have been declining of late, news of oil production cuts could ensure that prices won't go down a whole lot lower. 

The company's profits totaled $11.2 billion for the period ended Sept. 30 and were up 84% from the same period last year. Chevron has also been taking on projects and investments to increase its capacity, which could set it up for more growth opportunities down the road as it tries to take advantage of the strong demand.

Chevron's 3.1% yield is tops on this list as it has provided investors with the best of both worlds this year -- a high yield and some fantastic returns from a rising share price. Chevron's stock also looks cheap, trading at just 10 times earnings. There's a good margin of safety there in case profits fall in the event that oil prices continue declining. However, supply cuts could ensure that commodity prices don't fall too far down.

Investors looking for a way to hedge against rising inflation should consider buying shares of Chevron today.