I am not a lawyer, but I'm wondering if the same argument can be made about derived works such as text - the AI is learning from open-source code, and outputting not the exact same code, but just 'derived' code based on patterns in the original code.
In other words, somewhat similar to what a programmer studying existing and open-source code would do: read the code, understand it, and try to reimplement by writing their own code.