The advancement of science is of quite significant benefit to humankind in the long run and it affects everybody in a way a brand product implementing a known design does not. In fact, if it staves off extinction, even if it only matters in the far far future, the number of people affected could well be more than the one hundred billion who have lived on earth for the past 40,000 years.
They're definitely advancing engineering. They're also significantly improving space transportation infrastructure, which is crucial to getting more space-related science (and that includes a lot of stuff that is of terrible importance to biotechnology, which is likely to be The Next Big Thing after IT). Apart from that, they're directly working towards making humans interplanetary species and - as we just learned - fixing communication infrastrucutre before that.
Add to that the amount of interest they generate among people - they're beginning to achieve what Star Trek did once, making space cool again. I personally know people who are dreaming (and some moving towards) aerospace career because of SpaceX, and with the amount of hype you see around the Internet, I'm pretty sure we'll soon have a generation of engineers inspired by Elon's companies.
Oh, and they do all that for dirt cheap.
I don't know how good they're on an absolute scale, or compared to the next best alternative, but they're definitely very cost-effective in terms of current and potential benefits to humanity.
If SpaceX succeeds in significantly reducing launch costs, then they will enable a tremendous increase in all sorts of science (and industry, but you're talking about science.) There's tons of stuff to learn outside of Earth's gravity well, but right now we're restricted by the absurdly high cost of getting there. Most of the money now spent in all areas of activity that take place off-Earth is spent on or because of the high cost of getting there: launch services, making the machines light enough to launch affordably; making them robust enough to survive without maintenance; making them super-fancy to justify the cost; doing lots of simulations because you can't afford to test in the real environment.
For one small example: Space is by far the best place to put observatories. Yet only a few special--and small ones--are there. What if observatories were routinely space-based?
SpaceX may not be doing the science themselves, but have the capability to act as a huge multiplier to those who are doing it. A much higher multiplier than any feasible amount of money shovelled into the existing system would create.