By the book, you get 50% when selling a magic item. There have been plenty of alternate methods posted in the House Rules forums over the years, you might want to see some of them. I found one, from about three months ago:
http://enworld.cyberstreet.com/showthread.php?t=55583
Anyway, here's my view of it. The 50% guideline is the Pawn Shop price. That is, it's for when you have some used item that you just want to unload quickly. You have no real connection to it, it's not anything unusual, you just have no use for it. If it's a rare item, if it's in mint condition, if it has historical significance, or if you're willing to spend a bit more time finding a buyer, you'll get more.
Now, you say, "But wait! I made a magic item, it cost me that much AND I spent XP!". Well, you're not going to take your freshly-made item and dump it in a pawn shop. You've either made it for someone specific (in which case you're the merchant), or you have some connection to a shop or guild.
This brings us to one of the key points: D&D, for the most part, is a middle-ages economy. When barter suffices for simple goods and quality isn't easy to distinguish, there won't be as big of a division between merchant and customer. After all, you can just set up your own stall in the bazaar and sell the item yourself. When most items were made locally (especially food), you can't mark up the price as much. When people are members of guilds that can share resources and hand items down, prices stay lower.
McDonald's charges more than a buck for 5 cents worth of soda; that sort of pricing would never have worked in a more primitive economy. So, the merchant's profit margins will be lower than what we're used to; if he's asking 100gp for an item, it probably cost him at least 50 to acquire.
The exception is that Commodities (gold, silver, pepper, ivory, frozen concentrated orange juice) don't decrease in value. Sure, a merchant marks up the price a bit, because he's covering other costs, but it's not a huge change.
Also, that diamond merchant won't pay you a lot of money when you try to sell HIM a diamond, because he's getting them for even cheaper through his normal channels.
A FINISHED product, on the other hand, does have this depreciation. A gold ring is worth more than its weight in gold, because of the craftsmanship involved. So, the price of the ring should never drop below its raw material cost, but in D&D that's a flat 33.3%.
Bottom line: the D&D price system sucks. You'll be much happier if you just come up with something that makes sense. Make up some more realistic rules, and then be ready to ignore them when the players roleplay the haggling.