https://github.com/ethereum/go-ethereum/blob/master/core/state/statedb.go#L1328
go-ethereum store contract code in rawdb, the cost is smaller than store in iavl or MPT tree, and the default gas model is also designed according that assumption, the code storage charge 200 gas per byte, while SSTORE charge 20000 for 32bytes.
Proposal
Store contract code in rawdb rather than merkle state. We also need to implement a state sync extension to include it in state sync snapshot.