It's been a while, but as I recall, when you sell an item to a vendor for gil, it goes into a Buyback tab, where you can buy it back so long as you haven't left the area.

All we need is something similar for returning an item to the vendor, with the added caveat that you can't return an item if it's become bound to you or if you've otherwise "used" it.