Not sure if this applies to any circumstances in the OP or not, but who owns the territory the good is in also matters. If you have a trade agreement with the faction owning the territory you earn more from the same good.