It might be instructive to look at this from a pure accounting standpoint. There are two separate transactions here (the trade in and the purchase of the new gun) and it's probably best to look at them as such.
rock jock, basically you are negotiating the purchase of a pistol that costs $649. You wish to purchase the pistol with a different pistol (your trade in) and an unspecified amount of cash. The gun shop has an identical pistol to your trade in that they are carrying for $479.
The regular joe would look at that transaction and conclude that his trade in is "worth" $479, so he would simply hand them the pistol and $170, and walk out with a new pistol, with everyone happy. But we are dealing with the twisty world of retail accounting, where, albeit madness exists, it often has a method to it.
Let's look at how the gun store records the purchase of regular inventory (I'll ignore LIFO and FIFO for now so as not to complicate the issue, and just show it as a regular low-volume-type transaction.). The store buys a mil-spec from their supplier. The credit is to cash and the debit is to inventory. In other words, the carrying cost is the purchase price. Now let's look at a purchase. The debit is to cash and the credit is split...one portion zeroes out the inventory entry (carrying cost) and the remaining credit goes to Revenue.
Now let's look at your transaction. First, the store would have to carry your trade in at purchase price (that's not me, that's GAAP) in some manner. He thus has to true it up between the difference of the carrying cost of the other pistol in inventory and what he's giving you for it. Let's assume the carrying price (ie inventory value) of this pistol is normally $350. Since it's clear you were asking more for the pistol than the carrying price of the one already in inventory, the store would have had to eat the remainder in some kind of contra-asset account which is the equivalent of goodwill (which is amortized out over time as an expense on the income statement, as it's not a real asset...were I the store's accountant I'd insist on expensing it all immediately due to the nature of retail.). The entry thus becomes a credit to "Due To rock jock" for $479, a debit to inventory for $350 and an expense item for $129.
Now the gun store has an inventory item they MUST sell at $479 in order to break even. Assume they find such a buyer. The entry becomes a debit to cash for $479 and two credits: one to inventory for $350 and one to revenue for $129. However, that revenue entry is offset by the expense of the earlier initial trade, so there really is no profit in the deal.
The second part of the transaction becomes a little more convoluted. You have a credit with the gun dealer for $479. You want a $649 pistol. So you give him $170 and walk out with your pistol. The dealer would have to record the entry as a debit to cash for $170, a debit to "Due to Rock Jock" for $479, and a credit to inventory for the carrying cost of the pistol, with the remainder going to revenue. The dealer just turned a profit, right? Well, no because we're forgetting about the expense the dealer incurred in order to make the deal...$129. In other words, it cost the dealer $129 to sell the pistol to you, whereas if someone walked in off the street and bought it with cash they wouldn't have incurred any extraordinary expense in the deal. Now the dealer is assuming the risk that they could sell that pistol at $479. Is this a risk the dealer wants to take? I don't know anything about the pistol in question, but it seems to me that in retail there is very little that's guaranteed. Further, the profit margin of the pistol already in inventory may have a little (or a lot of) wiggle room built in that allows the store some flexibility in pricing...flexibility that's lost in the pistol they took in trade.
So how can they erase that expense? By offering you the carrying cost of the pistol they already have in inventory. There is still risk that they won't sell the pistol, but the risk is the same that they normally incur, and there isn't any extraordinary expense associated with that risk.
I know this is a long post and I'm probably being unnecessarily complicated, but the concept is that a trade in, unless made at carrying cost, will result in an expense to the dealer in the short term. Whether that expense is recouped eventually is the risk the dealer must be willing to make. rock jock, in your case the dealer didn't want to take that risk.
Goalie
(edited to add): rock jock, when you visit the store, it would be more revealing if the store sold the pistol they had that was comparable to yours, since that 's the transaction on which everything else hinges. If they sold the $479 pistol then that tells you they would have been able to sell your trade in and (assuming a little here) erase that expense.