A masterwork sword is 315gp worth of treasure. If you can't use that, resale price is a consolation prize. It's Dungeons & Dragons, not Shopping & Sales.
In earlier editions, treasure wasn't for selling. Items didn't have buy or sell prices, and if you found something you couldn't use, it had...