The 401k is actually an investment account that carries a tax deferral. For every dollar placed on the 401k plan, a tax deduction of the same amount can be claimed. So if you invest 10% of your earnings of $50,000 into your 401k plan, the IRS will treat your taxable income as $45,000.
In other words, the 401k plan serves two purposes for you. First, you gave an excellent way to financially prepare for retirement. Second, you have a good way of saving on tax liability.
However, when you begin to enjoy the benefits of your 401k plan and withdraw them, you will be taxed just like regular income. If you withdraw the investment before you reach the age of 59 and a half, you will be charged with a 10% penalty.