Selling something bad and buying something good in its place, if the dreamer is at war, signifies that he will die as a martyr, because he will have purchased the Hereafter and Paradise in exchange for this world. The opposite—selling something good and buying something bad—contains no good, and its outcome is feared. The interpretation of selling and being sold changes according to the thing being sold.
Seeing a free man sold signifies authority and a good outcome, based on the story of Joseph (peace be upon him). Selling also signifies being freed from the thing sold, while buying signifies desiring the thing purchased.