Derivative works are their own things (when sufficiently derivative). And AIs are not humans - using an algorithm does not automatically remove the copyright. See also "I uploaded a movie to youtube but it's upside down, why did it get taken down".
But that's because the movie is still recognisable. Using an algorithm doesn't automatically remove copyright, but if the algorithm transforms the data to a point where it can't be recognised as the original work, then it isn't breaking copyright.
But the AI as a whole is capable of reproducing the original in a recognizable form, and it does so on demand quite easily, because it was trained on them - how is it different than selling a zip file containing millions of copyrighted works, and also a bunch of new stuff?
Copyright law hinges on human element of the actions taking place, not on mathematical technicality. The digits of pi are not creative human expression, nor are they derived from human expression, they're a factual mathematical discovery. They can neither infringe on copyright, nor are they subject to it themselves.