When you sell a ship, the cargo price is included in sale price, which is of course correct.
Things go wrong though if you are replacing the ship (ie, buying a new ship at the same time). You get paid for the cargo, but you still keep the cargo.
Bug is easy enough to see in action, if you have a ship with lots of cargo, simply replace it back and forth with repeated purchases of another ship, and your gold with grow more and more with each purchase (from the cargo you get money for each sale but keep).
Searching the archives shows that this bug was reported before, and deemed fixed, but it seems to be a miscommunication, where what was fixed was actually a related but different bug: Medium Priority - Shipyard Sale Price: Cargo Included, but Kept Anyway | PiratesAhoy!
Things go wrong though if you are replacing the ship (ie, buying a new ship at the same time). You get paid for the cargo, but you still keep the cargo.
Bug is easy enough to see in action, if you have a ship with lots of cargo, simply replace it back and forth with repeated purchases of another ship, and your gold with grow more and more with each purchase (from the cargo you get money for each sale but keep).
Searching the archives shows that this bug was reported before, and deemed fixed, but it seems to be a miscommunication, where what was fixed was actually a related but different bug: Medium Priority - Shipyard Sale Price: Cargo Included, but Kept Anyway | PiratesAhoy!