The tax code is structured this way to incentivize saving for retirement. Social security exists for the same reason. The government allows you to defer taxation in these structured vehicles so that you are better able to care for yourself in your old age, so that the government doesn't end up footing the bill.
These accounts are no more a "give away" to the rich than the progressive income tax schedule is a "give away" to the poor.