(a) The attorney general may prosecute every person charged with the commission of a criminal offense arising from the violation of any provision of this article. In all such proceedings, the attorney general may appear in person or by his deputy before any court of record or any grand jury and exercise all the powers and perform all the duties in respect of such actions or proceedings which the district attorney would otherwise be authorized or required to exercise or perform; or the attorney general may in his discretion transmit evidence, proof and information as to such offense to the district attorney of the county or counties in which the alleged violation has occurred, and every district attorney to whom such evidence, proof and information is so transmitted shall forthwith proceed to prosecute any corporation, company, association, or officer, manager or agent thereof, or any firm or person charged with such violation. In any such proceeding, wherein the attorney general has appeared either in person or by deputy, the district attorney shall only exercise such powers and perform such duties as are required of him by the attorney general or the deputy attorney general so appearing.
(b) Upon any investigation before the attorney general or his deputy or other officer designated by him, or in any criminal proceeding before any court, magistrate or grand jury, pursuant to or for a violation of any of the provisions of this article, the attorney general, his deputy or other officer designated by him, or the court, magistrate or grand jury, may confer immunity in accordance with the provisions of section 50.20 of the criminal procedure law.