Warren Buffett has one man to thank for Berkshire Hathaway Inc.’s $29 billion windfall in 2017: President Donald Trump.

The Omaha billionaire backed Mr. Trump’s opponentHillary Clinton during the 2016 presidential campaign. But new tax cuts the president signed into law last December provided Berkshire with the sizable one-time gain that helped inflate annual profits to nearly $45 billion.

Other...