Wasn't copilot only trained on public GitHub repos? Presumably there's nothing stopping anyone from training on them.
Juat reading the code shouldn't be illegal, and producing a short snippet based on the code but not identical shouldn't count as a "substantial portion", but IANAL...