Inflation and gains

Can someone explain to me why do you recognize a gain for monetary assets during times of inflation?