Warren Buffett stands as one of history's most successful investors, and he's dispensed plenty of quotable wisdom in his decades of guiding Berkshire Hathaway to incredible returns. Perhaps his single-most-quoted bit of investing advice is that it pays to "be fearful when others are greedy and greedy when others are fearful."

With uncertainty roiling the market recently, there's no shortage of companies that have seen their valuations slashed precipitously from previous highs. However, one company in the Berkshire Hathaway portfolio stands apart as a particularly terrible performer as of late. Read on to see why Warren Buffett's worst-performing stock since the beginning of 2021 actually looks like a smart buy right now.

Warren Buffett smiling in a crowd.

Image source: The Motley Fool.

This beaten-down fintech has been Berkshire's biggest loser

StoneCo (STNE -2.42%) is a Brazil-based fintech that provides payment processing and credit services, mainly to merchants. While the stock enjoyed a run of success following its initial public offering in 2018, conditions have changed dramatically since the beginning of last year. Shares have gotten crushed due to a combination of inflation, other macroeconomic headwinds, and regulatory changes implemented by Brazil's government, basically cratering the company's credit business.

StoneCo's share price is down roughly 90% from its high, and the company is facing some big challenges. The chart below tracks StoneCo's legacy credit portfolio and its estimated fair value in Brazilian reals from the first quarter of 2021 through the first month of its current fiscal year.

A chart tracking the outstanding portfolio and estimated fair value in StoneCo's legacy credit portfolio.

Image source: StoneCo.pg. 10 PowerPoint Presentation (stone.co)

StoneCo has managed to sell some distressed portions of its credit portfolio, but management still estimates that more than half its legacy portfolio is bad. Due to new regulatory standards, the company has suspended lending to small- and medium-sized businesses and, ultimately, could be on the hook for somewhere in the range of 450 million Brazilian reals (roughly $90 million) worth of loans that wind up not being repaid.

Down, but not out

StoneCo's credit segment is in bad shape. On the other hand, its payment-processing business has continued to onboard new merchant partners and increase total payment volume (TPV) at an encouraging clip. The charts below track StoneCo's merchant payments customers, TPV on its platform, and revenue over its past two years.

Charts tracking StoneCo's merchant customer count, total payment volume, and revenue.

Image source: StoneCo.

While StoneCo is still getting a small payment-volume boost from Brazil's coronavirus stimulus program, overall TPV has grown at an impressive clip over the past year, and growth looks even more impressive if contribution from the program is backed out. Even better, the total-active-client count for its payment-processing ecosystem more than tripled year over year (YOY) in last year's fourth quarter.

The company has also made a push into the enterprise and human-resource management software business with its acquisition of Linx. Revenue from Linx rose 17.7% YOY in the fourth quarter, and software services revenue outside the unit rose roughly 82% to push total software segment revenue up 26.4% YOY. Through a combination of synergies with Stone Financial Platform, integration of other software services with Linx, and increased discipline with expense management, the company sees the software segment's margins climbing substantially this year.

StoneCo's credit business clearly isn't in great shape, and the company is on track to take a significant write-down on bad loans. On the other hand, its payment-processing and enterprise software segments still have strong growth potential, and the stock looks conservatively valued at present.

StoneCo is cheap and could benefit from big trends

With roughly 215 million people, Brazil is Latin America's most populous country and largest economy. While Brazil has seen rapidly increasing adoption of e-commerce and card- and mobile-based payments in recent years, overall adoption for these services remains in the early stages compared to the U.S., Europe, and Asia.

After a precipitous sell-off, StoneCo now has a market capitalization of roughly $3 billion and is valued at approximately 1.6 times this year's expected sales and 26.5 times this year's expected earnings. With the shift to card- and app-based payments and the rise of e-commerce still heating up in Brazil and Latin America at large, this beaten-down fintech stock may have big upside at current prices.