During the pandemic, legendary investor Warren Buffett and his company Berkshire Hathaway (BRK.A -0.10%) (BRK.B -0.09%) sold many of their bank stocks, as the Oracle of Omaha wanted to rightsize his portfolio and remove some of the potential risks associated with the banking sector early on in the pandemic. But many of these moves don't look so great right now, with much of the banking sector emerging from the pandemic in even better shape than before. Obviously, Buffett has been investing in banks a long time and clearly knows his stuff. He's also managing a $308 billion portfolio, so he has to think about losses and risk in a much more conservative way than your typical retail investor investing a few hundred or a few thousand dollars.

Still, there are two moves Buffett made during the pandemic that stick out to me and continue to look like stocks that Buffett and Berkshire should not have sold -- at least so early.

1. Goldman Sachs

In the first quarter of 2020 when the pandemic first started to emerge, Berkshire cut its stake in Goldman Sachs (GS 0.03%) by 84% and then exited its position in the investment bank entirely in the second quarter of 2020. During Q1, Goldman traded at a high of nearly $250 per share and a low of $138 per share. Goldman has since traded at all-time highs and now trades at $408 per share.

Investment banks obviously struggled during the Great Recession (2007 to 2009), but this time around they looked less risky, particularly because Goldman is not loaded up with traditional loans, which was a big concern during the pandemic with broad swaths of the economy literally shutting down for weeks at a time. Investment banks can also do very well during times of volatility, which proved to be the case throughout the pandemic, as equity and debt-underwriting activity surged, and the fixed income, currency and commodities (FICC) business also performed extremely well.

The global markets and investment banking business really didn't falter once during the pandemic, and you would think an investor as esteemed as Buffett might have had a better handle on that. Goldman reported earnings per share (EPS) of $24.74 in 2020 on net revenues of $44.6 billion.Through the first half of this year, Goldman has already surpassed that, reporting EPS of $33.62 and raising its quarterly dividend 60% to $2.

Additionally, Goldman continues to build out its consumer banking and asset and wealth management businesses in order to generate more stable earnings going forward. The business is therefore arguably in better shape than ever.

Warren Buffett in a public setting.

Image source: Getty Images.

2. Wells Fargo

Buffett has all but dumped his stake in Wells Fargo (WFC 0.23%), although he continues to hold the last remaining shares. The long-standing relationship really started to go south once the phony-accounts scandal at the bank came to light in 2016. Berkshire began cutting its stake in Wells Fargo even before the pandemic, and the sell-off continued throughout the pandemic. Around 2016, Berkshire owned as many as 500 million shares in Wells Fargo; now it just owns around 675,000 shares, which I would expect to be sold soon. This was inevitable as Buffett has said before that the company rarely trims positions and usually sells off stocks completely once it decides to exit a position.

The thing is that as Buffett has been selling, a lot of positives have emerged for Wells Fargo. After the stock hit a pandemic low of roughly $21 per share in October of last year, CEO Charlie Scharf announced a large cost-savings plan that will see the bank cut $8 billion of gross expenses over the next three to four years. Scharf has also sold business lines that aren't core to the bank's U.S. franchise and begun to ramp up credit card lending and investment banking, both businesses that can be very profitable.

Then, earlier this year, Wells Fargo received some good news on the regulatory front. Following the phony-accounts scandal, the Federal Reserve placed a $1.95 trillion asset cap on the bank in early 2018, which is now considered one of the costliest punishments ever placed on a bank. In February, media outlets reported that the Fed had approved the bank's risk-management and governance overhaul proposal, a big step toward getting the asset cap removed, which will allow the bank to once again grow its balance sheet. There were rumors that Buffett was not a big fan of Wells Fargo's decision to hire Scharf, but so far the Wall Street veteran seems to be doing a good job.

Wells Fargo stock has more than doubled from pandemic lows and is now much closer to pre-pandemic levels. But more importantly, the company appears to be on a much better path with the current expense and revenue initiatives at the bank, as well as the bank getting closer to asset cap removal. Remember, Wells Fargo is still one of the largest commercial lenders in the country and was a very strong bank leading up to the phony-accounts scandal. I do think this is a bank that can thrive once again.