A state agency in South Carolina is on the hook for a contract worth millions of dollars more than officials realized.