It's not like when they give Apple this "discount" it goes along with a reduction in spending elsewhere. They're effectively reducing their tax revenue without any offset in costs and the tax payers have to make up that difference.
Offering the discount gets an increase in total tax revenue for Iowa and its residents, since it allows it to get something instead of nothing.
However, your argument certainly applies in a wider context - from the perspective of all states together it would make sense to not offer the discount and avoid the race to the bottom, but as they're not coordinated and each care about their own interests, then it makes sense for them to "defect" and offer such discounts to ensure that the facility gets built at their site.
Iowa was willing to provide their services at a hefty discount, so Apple chose to "buy" them from Iowa and not another state - but in any case Iowa gets money from Apple (just not the listed rate) and the citizens of Iowa are better off than they would have been if Apple wasn't placing that facility there and thus would pay zero taxes to Iowa.