Despite surging covid cases and climbing inflation, Americans’ retirement account balances continue to rise to record levels. Others, though, are fighting to pay rent — unable even to think about investing for the future.

Let’s look at the haves who are saving for retirement in workplace plans.

Fidelity Investments just released its quarterly analysis of more than 30 million 401(k) and 403(b) retirement accounts. Average retirement account balances maintained an upward trend for the third straight quarter.

Workers who continue to contribute to their plans, even as the pandemic produced some heart-clutching moments in the stock market, were rewarded with significant increases in their account balances, according to Fidelity, the largest administrator of workplace retirement accounts.

In fact, as the pandemic caused people to lose their jobs, 38 percent of 401(k) savers increased their savings rate. And this wasn’t just among older workers, who you might expect would contribute more as they get closer to retirement.

“People are really seeing the benefit of long-term investing,” said Jessica Macdonald, vice president for thought leadership at Fidelity.

Macdonald said 85 percent of the growth in account balances came from stock market performance.

The average 401(k) balance increased to a high of $129,300 in the second quarter of 2021, up 24 percent from the same period a year ago. The average 403(b) account balance increased to a record $113,300, also up 24 percent. The average IRA balance was $134,900, a 21 percent jump over the same period in 2020.

More millionaires were minted in the second quarter (at least on paper and before taxes). The record number of workers with accounts of $1 million or more increased to 412,000, up 84 percent from the same period a year ago.

Although the number of millionaires is relatively small — about 2 percent of 401(k) plan participants — the growing number of members in this select club is staggering when set against the backdrop of poverty spurred by the pandemic. Millions of people have been forced to live off unemployment payments or to wait desperately for monthly child tax credit payments that are being delivered to help families suffering from the financial fallout of covid.

Meanwhile, the overall average balance for individuals who have been in their 401(k) plan continuously for 10 years crossed the $400,000 threshold for the first time, reaching $402,700 in the second quarter, up from $83,900 in 2011.

If you’re 50 or older, there’s a catch-up provision that allows you to contribute a maximum of $6,500 to an employer-sponsored retirement plan. A record 18.2 percent of baby boomers made a “catch-up” contribution to their 401(k) in the second quarter of this year. By the end of last year, 58 percent of boomers had made the maximum catch-up contribution of $6,500.

The average 401(k) savings rate reached a new high of 9.3 percent in the second quarter, according to Fidelity. Younger employees boosted their contribution as well. More than half of Gen Z workers (people born between 1997 and 2012) increased their 401(k) savings rate to 6.6 percent of their pay in the second quarter.

This is all really good news, and people who can afford to save should be applauded for staying the course and recognizing the benefit of patient investing.

“American workers are really showing us some positive behaviors towards their long-term savings,” Macdonald said.

But the flip side of Fidelity’s report is the realization that not everyone is reaping the upside of the stock market. And this is an unsettling dynamic. Or should be, even if you were one of the many whose retirement accounts grew.

“Lower-income adults, as well as Hispanic and Asian Americans and adults younger than 30, are among the most likely to say they or someone in their household has lost a job or taken a pay cut since the pandemic outbreak began," the Pew Research Center reported in March.

This group also had to take on debt or put off paying bills to make ends meet, according to Pew.

Pew found that 51 percent of adults in the workforce said the pandemic would make it harder for them to reach their long-term financial goals. This should concern us all because it will put a strain on the state and federal safety nets that were struggling to keep pace with the demand for assistance even before the pandemic.

The pandemic could accelerate shortfalls in the Social Security Trust Funds. When you’re worried about paying for necessities, retirement saving gets pushed down your list of priorities. This will in turn result in people relying even more on Social Security as the only source of retirement income.

Many people are profiting despite the pandemic. That’s not a criticism but an observation that behooves us all to do what we can to reduce the wealth gap.

My own retirement accounts ballooned, but I don’t feel like celebrating when so many others are suffering.