You can sell or give the contract to another player, either before placing the merchant or after dismissing it.
Merchants trade ownership when the contract is traded.
If you change [[kingdom]], you will lose the contract, since the merchant stays in the old kingdom.