THE state government has narrowly avoided a carbon price bill of about $400 million under a secret deal struck with Alcoa whereby the Gillard government will cover much of the costs.