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.

What Is the Significance of a “Memory-Hard” Algorithm in Resisting ASIC Development?
Why Is the Gas Fee Still Charged Even If a Transaction Reverts or Fails?
How Does the ‘Out-of-Gas’ Error Impact a Smart Contract Transaction’s State Change?
What Happens to the Gas Fee If a Smart Contract Execution Fails?
Why Is the Fee Still Paid Even If the Transaction Fails?
What Is “Gas” in the Context of Smart Contract Execution?
What Is the Role of a “DAG File” in Memory-Hard Mining Algorithms?
What Is the Difference between Gas Limit and Gas Price?

Glossar