The New York mayor, who hasn’t been accused of wrongdoing, says he is cooperating with a federal corruption probe.