Towns hold shops that both buy from you and sell to you. Shops carry their own icon on the map, and what a shop deals in depends on what kind of shop it is: general stores, clothes shops, electronics shops, drug dealers, vehicle shops, and the gun dealer, which has a page of its own.
Money is a balance recorded against your player, not something carried in your inventory, so it cannot be dropped or looted off you.
Every item has a base price, and the price a shop quotes is that base adjusted for where you are standing:
A shop only has so many of each item, and how much a town can hold depends on its population, its stability and how sought after the item is. Townspeople buy from the shelves as the days pass, so stock falls even if no player touches it. Each morning at 7am shops top themselves back up towards that ceiling, and anything you sell goes straight back onto the shelves.
A shop that deals in one kind of goods only buys that kind back, so a clothes shop will not take a rifle. Gun dealers and drug dealers have no such list and will buy almost anything with a price on it. Two other rules apply everywhere:
The shop menu greys out a row it will not buy and says which of those rules stopped it. Vehicle shops and procurement points (garages, helipads) sell only and never buy.
Trading is also visible to the town: business over a small threshold at an ordinary shop lifts that town's stability for a while, whereas a large deal at a gun dealer drops stability and raises town support instead.