Why Is the Consumed Gas Not Refunded upon Transaction Failure?
The consumed gas is not refunded because the computational work was still performed by the network's nodes and the validator, even though the transaction ultimately failed. The validator must be compensated for the resources (CPU, memory) used to execute the failing operation up to the point of the 'out-of-gas' error.