I'll chime in here a little seeing I'm a Gun Store Counter Monkey.
I'll have to second Charles anology of a car. Another thing the Dealer considers is how well that particular firearm sells.
Example (older generation gun v current generation gun)
Say you have a first generation Glock 17 that you paid $450 for.
A new, third generation Glock 17 goes for $565.
A Dealer could probably sell your Glock for at most $400. Glocks sell very well. However, for $165 difference, the majority of people would opt for the new one (with warrenty and updated features.
So you go in to trade. Realize that the Dealer has to make a profit (it is a business). He probably also has a minimum profit he wants to get out of the gun... lets say $75. He also knows that most people would opt for the newer gun. He knows he can mark this gun at $400 but probably won't move fast so he'll have a minimum price he will sell the gun for... lets say $350 ($200 difference btwn old and new). He would then back out the his minimum profit of $75 and offer you $275 for your Glock.
Now that is with a gun then is very desirable and people want.
If you have a firearm that is not as desirable and doesn't move that fast the price offered is going to be much lower. The reason being is that
what ever the Dealer puts into the gun it is considered tied up until the gun sells. If the gun isn't a fast mover he will have to price it low to move the gun. If he prices it low that means after he backs out his profit from the minimum price he is willing to sell it for you are not going to get much for your gun.
A good example was a guy that came in with 4 rifles, all military surplus... I remember a the AK. We sell AKs for about (IIRC.. they are over in the Tactical Section where I'm not allowed :? ). The others were not quite as desirable being bolt guns. All the guns were well used (not abused but very well used). We offered I think $450 for all of them. The guy went ballistic!! He wanted $1200... said we were selling AKs for over $400. What he failed to take into account were the condition of his guns (verse the condition of the ones going for $4XX), the desirability of the bolt surplus guns (verse a sproting bolt gun), and the retail profit needed to keep the store open.
We try and do the best deals we can... you don't build a profitable business without repeat customers, and having fair prices. However, problems arise when one side of the transaction is looking at it from a emotional aspect and the other from a economic aspect.
I don't know people who trade every week but if someone does they are probably losing money every time.
We have more then a few customers that do! One gentleman has owned
every Kimber (at one time) and been through numerous other guns (H&K, Springfield, Sig (sorry not Glocks for this Gentleman!)). He'll buy one, shoot it for a while, deside if he likes it or not and if not trade it on another. Each time he losses (what some would consider a lot for the time he had the gun) money... but he understands the economics of it. To him it is simple, he doesn't like the gun so he gets a different one... same day, no hastle, no hidded fees, no worries about whom he sold to. Fast, easy, his hands are washed of the gun and he can try out the new one.
I have people ask me if they can try out a (new) gun. I tell them yes, the rental is $250. You buy it for $750 (say an H&K), take it out and try it out, if you don't like it well buy it back for $500 cause it is now a used gun.

They then kind of realize why they can't.