State's hospitals could lose millions through payment loophole