Plus on top of that it's been ruled that training on copyrighted material is allowed because it's transformative. As a result even if the model output is copyrighted training on it would be as allowed as training on books.

If this was ruled ok why are they paying billions to book publishers?

Yea to be more explicit than the other reply they are being fined for the theft of the books not training on them. They trained on tons of legally procured books by destructively scanning and OCRing them. It was discovered in legal filings and is called Project Panama if you want to read more about it.

Because they pirated said books instead of buying them legally.