NEW YORK — Microsoft Corp. co-founder Bill Gates remains the nation’s richest man by far, as the tech and philanthropy giant took the top spot on the Forbes 400 list for the 19th year running, with a net worth of $66 billion.

Investor Warren Buffett, the head of Berkshire Hathaway Inc., again took second with $46 billion, while Oracle Corp. co-founder Larry Ellison remains third with $41 billion and brothers Charles and David Koch, co-owners of Koch Industries Inc., tied for fourth with $31 billion.

Forbes said the rich mainly got richer in 2012, with net worth rising for 241 members of its list and shrinking for only 66. Rising stock prices, a rebound in real estate values and rare art prices helped.

More members of the Walton family, the founders of Wal-Mart Stores Inc., moved up into the Top 10, displacing investor George Soros and Las Vegas Sands Corp. founder Sheldon Adelson. New York City Mayor Michael Bloomberg, who made his fortune with the financial data services firm Bloomberg LP, is also back with the top dogs at No. 10 with an estimated net worth of $25 billion.

Social media moguls took the biggest hit. Zynga Inc.’s Mark Pincus and Groupon Inc.’s Eric Lefkofsky dropped off the list entirely. Facebook’s Mark Zuckerberg was the biggest dollar loser in Forbes’ latest ranking of the 400 wealthiest Americans. The company’s lackluster IPO in May resulted in a huge drop in market value that cut the value of his shareholdings almost in half, costing him $8.1 billion in net worth. That dropped Zuckerberg from No. 14 on the list to No. 36.

But although Zuckerberg lost more money than most people will make in many lifetimes, his net worth still totals an estimated $9.4 billion, according to the magazine.

Twenty newcomers joined the list, which required $1.1 billion in net worth for entry, up from $1.05 billion a year ago. Among the freshly minted are Shahid Khan, owner of the NFL’s Jacksonville Jaguars, at No. 179; Judy Faulkner, founder of health records firm Epic Systems, at No. 285; Andrew & Peggy Cherng, the husband and wife team behind restaurant chain Panda Express, at No. 239; and Twitter creator Jack Dorsey at No. 392.

There are 45 women on the list, up from 42 a year ago, including Oprah Winfrey at No. 151.