IIRC, courts in the US ruled it's legal to produce entirely fictional art depicting children in explicit scenes, so long as no real minors were involved in production.
Just Google "arrested for AI generated CSAM" and you will find tons of cases, including police officers as perps. Looks like the Protect act of 2003 make it illegal if basically looks real enough (cartoon ok, AI generated realism is apparently not).