Having been eager to find games like this myself, I can pretty much say The Guild and its sequel are exactly the sort of thing you're looking for. Unfortunately, no other games really come anywhere close.
The games have towns with full supply/demand trading and economy; everything is resource gathered/crafted.
There are 'filler' NPCs, and then there are the major Families. Family NPCs are numerous and perform all the actions you can, including marrying/having kids, buying and selling houses and businesses (and making improvements/renovations), trading, buying and using personal items (weapons, perfume, poems), participating in council meetings and running for offices, and doing things to either befriend other families (including yours) or sabotaging them.
You and the NPCs can run for council offices, which give you power over such things as taxes, or ordering business inspections (fucks with their productivity) or even locking someone you hate up in jail.
Towns are governed by law and criminals are prosecuted in courts. The entire system -- from holding an office where you have control over the city guardsmen, right down to being a prosecutor or even judge of the trial -- is entirely open to you and other NPCs.
You can bribe people or flatter them, or give them gifts. Conversely, you can slander them to other people (spread rumours to lower their reputation with other people), or steal from them, or get them voted out of offices. NPCs can also do all of this to you.
Towns grow as they prosper, and you can end up filling all the office seats and running things exactly how you want.
The only serious flaw in The Guild games, are their buginess. Thankfully, most issues have by now been addressed through patches and expansions.
It is a seriously impressive "medieval life sim" game.