It basically comes down to math and taxes. Here's a vastly oversimplified scenario. Think about how you'd automate this. It ain't easy, is it?

Say you have, say, $10M under management, and the index is at $3,228.90, as it is right now according to Google. For simplicity, let's just make your share price equal to the exact value of the index (which it theoretically would be with no tracking error).

If you do the division, you find out that you have to allocate 3097.02994828 shares. If you're an ETF, that's literally impossible. If you're a mutual fund, you can do it, but it introduces some accounting overhead to deal with fractional shares and the like. That's okay for the mutual fund, but not great.

As far as taxes, one thing you want to do is hold at least some cash in your fund's portfolio so you don't have to be constantly buying and selling to fulfill purchases. Buying and selling generate capital gains, which you want to avoid as much as possible. However, this also introduces a bit of cash drag to the portfolio, which introduces some tracking error, so your share price will never exactly match the index. That right there blows our assumption that your share price is exactly the current value of the index.

Again, because of taxes, you don't want to just own the exact amount of stock necessary to allocate the number of shares you have outstanding. You probably want a bit of a buffer in terms of shares, so you can deal with orders by just twiddling bits internally in your accounting system rather than trying to go to the market and buy shares "just in time" (which is, of course, literally impossible, because the index moves in sub-millisecond time steps due to HFT).

So, given that you can't just own 1 share each of all 500 S&P 500 companies and say that's one share of your fund, what you do is go and pick a basket of stocks that, when added up together, correlate well to the index price. You can pick 10, 30, 50, 100, or whatever stocks, but you have to do a lot of number crunching to figure out precisely which stocks you want to include.

You want to do this tax-efficiently (remember what I said about avoiding buying and selling), and you also want as low of a tracking error as possible. This is a hard problem. Software can aid in solving this problem, but you need to pay people to make sure that your software does something sensible and isn't going to drown you in taxes.

And, then, there's the small matter of dividends, which complicates the hell out of things. If you don't own all 500 stocks and call that 1 share of your fund, your dividend will not match the sum of all the dividends of all 500 stocks in the index. That's fine, but you have to be aware of it, and you have to track dividend dates and amounts for however many stocks you hold.

Did that convince you that running an index fund isn't as simple as it sounds? :) That's why all funds, including index funds, have a nonzero expense ratio. Ya gotta pay for all this processing.

Oh, and I haven't even covered rebalancing and all the headaches that go with that at scale. And, because you're not Joe Six Pack investor, you're not trading on a $0 commission platform. You're paying for pro-level access to the market.

TL;DR: Owning all 500 stocks and bundling them as 1 share is pretty impractical. Since every trade you make on the open market costs money and possibly generates tax liability, you want to avoid that as much as possible and fulfill orders via moving bits around in your internal accounting systems. These systems are nontrivial.