Suppose a miner mined a block and the block got added in the main chain of the block chain. He must have got his mining fee then. Now suppose that due to a fork sometimes later, the block that he mined is no longer a part of the main chain, i.e. that block is orphaned now. Then would he retain his mining fee or would it get deducted?
If the block he mined is no longer a part of the main chain, then his mining fee for that block would simply not exist on the chain. So the miner would not retain the fee, but it wouldn't technically be 'deducted' either. 'Deducted' implies that the system is reducing the value of the miner's account. Instead, the system just has a different UTXO set, which does not include those mining fees.
When a block gets mined, the block reward and fees can only be spent by the miner after 100 blocks. If block gets orphaned before that, the reward and the fees are note deducted, they never get to exist at all.