It can be wiggled around. For example, if I ship a robot which can paint a famous painting, but not the painting itself, I would argue the copyright violation happens by the user of the robot when it paints the painting, not by the maker of the robot.
If that's something I'd planned on and intended, and you own the copyright to the painting, you have all sorts of legal tools to go after me -- contributory infringement, collusion, and so on. Still, contributing to a legal violation is not the same as engaging in one.
I suspect an argument can be made that github now incorporates AGPL code generated by co-pilot, and so is AGPL. A fair use argument might be made as well; we've all copied one-liners from blog posts and tutorials, and that's okay. I'm having a harder time seeing a reasonable argument that an ML model is directly infringing just because it can produce a copyrighted work, though.
So I don't think it's a cut-and-dry legal question.
I will give a caveat: Coders tend to read laws much too literally, like computer code. When I was was an obnoxious teenager, I thought I'd found all sorts of contract / license / etc. loopholes in all sorts of legal documents, and I considered myself profoundly clever, thinking I'd outsmarted the lawyers.
Nope.
In college I took law classes, got into the real world, did a few startups, and saw a few legal cases. Court systems have technical rules you need to be aware of, of course (e.g. if you miss a deadline....), but interpreting the law is really grounded in common sense. Common sense is culturally situated, and ours is situated in hundreds of years of case law.