States imposing fossil fuel laws risk up to $340bn in oil and gas settlement costs