I've noticed that when a contract factory creates a new contract with the 'new' keyword, the transaction costs an absurd amount of gas as if it were deploying the contract for the first time. I don't understand why such a high gas cost, if the contract has been deployed before and the code is already 'in the blockchain' then why does it need to deploy the whole code again.
Here's an example:
The 'createToken' function of the TokenCreator contract, creates an object of the OwnedToken contract. But why does it cost as much to call the function as does deploying the OwnedToken contract, if the code is always the same?