IRA is not always an option. There are income limits for IRA, that leave many employees (those with the higher salaries, but not exactly the "riches") out of it. Same for Roth IRA, though the MAGI limits are much higher.
Also, the contribution limits on IRA are less than a third of what they are on 401(k)s (5K vs 16.5K).
Per IRS Publication 590 (page 12) the income limit (AGI) goes away if the employer doesn't provide a 401(k) or similar plan (not if you don't participate, but if the employer doesn't provide). But deduction limits don't change, it's up to $5K (or 100% of the compensation, the lesser) even if you're not covered by the employers' pension plan.
Employers are allowed to match the employees' 401(k) contributions, and this comes on top of the limits (i.e.: with the employers' matching, the employees can save more for their retirement and still have the tax benefits).
That's the law.
The companies offer the option of 401(k) because it allows employee retention (I would not work for a company without 401(k)), and it is part of the overall benefit package - it's an expense for the employer (including the matching). Why would the employer offer matching instead of a raise? Not all employers do. My current employer, for example, pays above average salaries, but doesn't offer 401K match.
Some companies have very tight control over the 401(k) accounts, and until not so long ago were allowed to force employees to invest their retirement savings in the company (see the Enron affair). It is no longer an option, but by now 401(k) is a standard in some industries, and employers cannot allow themselves not to offer it (see my position above).