If perfect capital markets exist (ie there is only one price for their product that all companies offer) than the transfer price should be set at market price less a deduction on the saving made by selling internally (delivery, packaging costs etc).
If there is a surplus capacity then the company should set transfer prices so that they recoup marginal costs however should not set the price higher than what is available from external markets (ie another company).
If there are production constraints then the price should be set at opportunity cost – so the amount lost by not selling to an external party who are willing to pay a certain amount.
From a legal / ethical and tax perspective, transfer prices for multinationals should be set at an arms length price.
Hope this helps