Not owning the rights to some content and somebody else owning those rights are not the same thing. If someone else owns the copyright and you redistribute their stuff without permission, they have grounds to sue you. If nobody owns the copyright, because it expired long ago or because it came into being without human creative input, you can sell it just fine. So can everyone else, of course. Now, if you put your own stuff on top, that you own the copyright to, those other people can no longer redistribute it without your permission, but you can. So there's hardly any risk in using uncopyrightable background art.

Unless the "AI" content output is fundamentally unable to prevent piracy of other peoples content (it demonstrably can't even on a CEO live stream.) Most models will happily spew any statistically salient trademark, copyrighted and or patented code/music/images/video. Note too, GPL/LGPL is a contaminating license, so legal submarines will surface sooner or later if injected into closed-source projects.

The "how" it happens part is just legally irrelevant "[piracy] with extra steps", but if you are interested in details see below. =3

https://www.youtube.com/watch?v=YhgYMH6n004

https://www.cbsnews.com/news/taylor-swift-ai-voice-likeness-...

Here is a simplified explanation of how vector search is done in many models:

https://www.youtube.com/watch?v=YDdKiQNw80c

And a more detailed toy implementation to learn how to build your own:

https://www.youtube.com/watch?v=OUE3FSIk46g