Beat the market. That's the goal for most investors. However, achieving that goal is often easier said than done.

It wasn't difficult for quite a few U.S. senators and representatives last year, though. Over 30 of them managed to beat the market, with some of them raking in gains more than four times greater than the S&P 500. Meet the ultrahigh-yield dividend stock that helped one member of Congress generate a 122% return last year.

Rep. Mark Green's income machine

Rep. Mark Green, R-Tenn., was the second-best stock trader in Congress in 2023. He achieved a return of 122%. How did the GOP representative do it? Primarily through his investments in energy stocks, with one especially standing out.

Energy Transfer LP (ET 1.94%) has been a staple in Green's portfolio for several years. The company is a leader in the North American midstream energy industry. Energy Transfer operates around 125,000 miles of pipelines that transport crude oil, natural gas, and natural gas liquids (NGLs).

Arguably the biggest reason many investors are attracted to Energy Transfer is its distribution. The midstream energy company's distribution yield currently tops 7.2% and was even higher throughout most of last year.

Why Energy Transfer was a big winner for Rep. Green

Energy Transfer's shares (technically called units because the company is a limited partnership) jumped 16% in 2023. However, Rep. Green's profits from selling units multiple times last year were likely much higher because Energy Transfer delivered even greater gains in 2021 and 2022.

One reason Energy Transfer was such a big winner for Green is that energy stocks in general have rebounded strongly since crashing during the early stages of the COVID-19 pandemic. At one point in March 2020, Energy Transfer lost roughly two-thirds of its market cap.

It also helped that the company reported solid quarterly-earnings results several times in 2023. Energy Transfer started off the year on an especially good note with strong first-quarter earnings and raised its full-year outlook for adjusted earnings before interest, taxes, depreciation, and amortization (EBITDA).

The company's dealmaking was a key factor in its performance as well. Energy Transfer closed on its acquisition of Lotus Midstream in May 2023 and closed its buyout of Crestwood Equity Partners in November 2023.

Rep. Green owned other stocks that were important in his market-beating return last year. For example, NGL Energy Partners LP, another midstream energy stock, skyrocketed 360%.

Is Energy Transfer a good stock to buy now?

I think Energy Transfer is a good stock to buy right now for some investors. Anyone seeking income should like its ultrahigh-distribution yield. The company expects to grow its distribution by 3% to 5% annually.

Value investors should also find Energy Transfer attractive. Its units trade at less than 9.6 times forward earnings. By comparison, the S&P 500 energy sector's forward-earnings multiple is nearly 13.

Growth investors might prefer other stocks with even stronger growth prospects than Energy Transfer. However, the midstream energy company could be a better option than you might think. Analysts expect Energy Transfer's earnings will increase by an average annual rate of 15.8% over the next five years.