I had this DM back in the day who treated our characters like our levels were stamped on their foreheads.
On one of those rare occasions when I got to play instead of DM, my best friend ran D&D for us and it was fun. It was a good game, but one thing that used to seriously bug me was when we encountered practically any NPC of any importance. It was like we had our character levels stamped on our foreheads because we were treated like total nitwits at low levels and maybe a little respect at mid levels and a reasonable amount of respect at high levels.
Was it an outcropping of BECMI and old school AD&D that had our character classes attached to these sometimes silly titles? Seriously, I’d be a level 8 Fighter for life… It’s not like my character walked around introducing himself as Benedon the Acolyte. My friend who we’ll refer to as Todd was already name-impaired enough and “Butt-Stomping Butt Stomper” really needed no further introductions. But all of our characters, regardless, were treated like noobs and it didn’t matter what we did, either.

Borrowed from AD&D First Edition.
Save the whole kingdom from a Drow invasion? Noobs. Peasants. Losers.
Save the whole kingdom from a rampaging Black Dragon? Yup, we were still insignificant. I mean, that one was kinda our fault for looting her dungeon and killing all her minions, but…
Walked around town bristling with magic items and shiny armor getting our castle built? Well, at least our gold was good. But the NPCs always seemed to know our levels regardless.
It didn’t change when we got to college.
Different group with a different DM in college asked me to sit in on his game. I played a cleric again. They always need a healer… We were still playing BECMI, modified heavily with house rules. Like to guess how our characters were treated by every NPC we met? Yup. “Chumps.” “Noobs.” “Idiots.”
The major difference was it didn’t even matter what level we were. I started doing things just to get noticed by the royals. I turned entire waves of an undead army. I healed rooms full of the sick and injured. I rezzed an entire unit of dead soldiers. (Heh heh. Spell points. No mats.) I got some negative attention from a couple of gods on that one, though. Still, we were the Rodney Dangerfields of that D&D world.
The crazy part of this story is: these weren’t even new DMs! Both DMs in question had multiple years of experience as a DM and as a player. I might have made that mistake with my first campaign, but since then? No way. Every NPC has a different personality from the stable boy all the way to the queen and treat PCs accordingly. It’s all about respect.
The lesson here is:

Please don’t do this to your players! I would like to think roleplaying has evolved well beyond over simplified interactions with stereotyped characters. I strongly urge DMs to treat the characters in a way respective to their station and behavior. People should be reacting reasonably in character.
Yes, royals will treat peasants like… well, peasants. Mileage may vary depending on the kingdom. The innkeeper and the barmaids will generally treat paying customers with respect so long as they don’t torch the place and kill everyone. I think we get the idea.
You can’t get it “wrong.” Certainly you don’t have to be perfect. No player should have to take acting lessons. No DM should ever have to study, uh- Sociology, Anthropology, Archaeology, World History, Ethics, Economics, Creative Writing, Acting, Art, Philosophy, and Engineering in order to build a world and run a game. Just play the game and be decent to each other.
If your DM seems to be dumping all over your characters in game, maybe it’s time to chat with them outside of the session. It’s a simple conversation to have. Please listen with curiosity. Maybe the Duke is a really snooty dude, the innkeeper is reminded of someone they truly despise, and the local sage looks down on everyone. If it keeps happening, try talking to the DM again, or just find another game. Trust me, DMs learn what not to do next time when their players start bailing out.
Out in the real world: please treat everyone, especially your DM, the way you would want them to treat you. Be kind. Be gentle. Take care. See you soon.