Yeah, it is not common for a person elected to Congress or the Senate to be “working class” or even “middle / upper middle class”, most are actually rich. That doesn’t mean $50m in the bank rich, but it might mean “partner in a successful law firm, $850k paid for house, few million in stocks and bonds, few million in other assets” wealth at age ~45, which is well ahead of the upper middle-class clip. Someone who goes into Congress with say $5-8m in assets, just passively invested in index funds, plus their congressional salary, who then serves for 20-30 years will absolutely be worth somewhere in the $15-30m range without it being too hard, starting from that base of $5-8m and enjoying market rate returns for a couple decades has you looking pretty good.
Bernie Sanders, and there are a couple congressmen / Senators who have a similar financial background to him, is a not-uncommon situation. Joe Biden actually had a similar wealth situation to Bernie until he became Vice President. The baseline pay is generally not terrible, and the benefits are really good. The cost of housing in DC is high, but if someone had a 25-30 year career, there were more options for cheap residences in and around the District back then, and if they bought one, they would also have benefitted from the high appreciation of District-area real estate. Biden famously commuted on the train from his house in Delaware to DC every day.
Someone in that Bernie or Biden income range, put a few decades in Congress in and they are going to naturally be worth millions of dollars. Congress has a pretty good 401k style savings program that if they are smart at all they participate in, and a lot of that is just passively getting market returns (they are in the Federal Thrift Saving Plan–they also have traditional defined benefit pension plans.)
Now, if someone then becomes “genuinely famous” that money is likely to increase rapidly. Often times when “people of a certain persuasion” are wanting to make a “point” about a politician who has x amount of money despite “only ever working” as a civil servant, frequently miss this point. Take three prominent Democrat examples: Barack Obama, Bernie Sanders and Joe Biden.
Both eventually emerged onto the national stage, this enabled them to be able to sign lucrative book deals. There is nothing against Congressional rules in publishing a book and collecting the earnings from it. Barack had a famous, New York Times bestseller before his Presidency. Bernie between 2009 and 2018 earned around $5m, $2.5m was from a book deal that he obtained after his 2016 primary performance and emergence on the national stage–around $2.1m was from…salary, highlighting that their salary does add up.
Biden didn’t really cash in until after his Vice Presidency–that’s when he got his first and only lucrative book deal, and started being able to command six-figure per appearance speaking fees. Barack Obama despite being quite comfortable from his book from before his Presidency, rocketed upwards of $100m in wealth after his Presidency primarily through book and other media deals. He reportedly got around a $65m advance on his big post-Presidential book, and a $50m Netflix deal. Unlike infamous figures Bill Clinton and Hillary Clinton, Barack has not nearly embraced the paid speaking circuit to the same degree (very likely because of the political baggage it has attached to the Clintons.) That is not to say Barack has not done paid speeches, just that he hasn’t gone at it hard in the paint like the Clintons did, Bill and Hillary essentially made doing those speeches a full-time job (Bill after the Presidency, Hillary in the period between her time in government and the 2016 campaign), they were regularly doing like 150-200 paid speech appearances a year, and clearing tens of millions of dollars a year in speaking fees. However Obama has been much more limited in speaking engagements–he has tended to make even more per speech than the Clintons, sometimes reportedly upwards of $650,000 per speech.