A smart contract can be compiled into EVM bytecode (Ethereum Virtual Machine) and deployed to Ethereum blockchain on a block with specific block height, and return a transaction hash.
But in what way does a smart contract stored on a block? And how does the blockchain record state change, when a transaction has been issued to interact with that smart contract to change its state (e.g. the value of a variable)?