How does the hash of a coinbase transaction differ for the same miner?
The script of the input to a coinbase transaction can hold up to 100 bytes of arbitrary data. After BIP 34, the block height must be the first thing in that script. Since each block has a different height, this rule ensures that each coinbase transaction is unique as the block heights will always be different.

Furthermore, since miners can put whatever arbitrary data they want in that input script, they frequently use that as an extra nonce. Instead of reselecting transactions when all of the nonces are exhausted, miners will increment a value known as the extranonce which is put in the input script.



Also, before BIP 34 activated, there were in fact cases of identical coinbase transactions in different blocks. Only the outputs from the most recent of these identical coinbase transactions are spendable. Spending outputs from these transactions does not spend all of the outputs, only the ones from the most recent one. This means that the outputs from the earlier coinbases are unspendable and those coins are provably lost forever.