It's funny how you pretend this is a 'moral' issue but then just end up with a copyright law conclusion.
While AI generated code cannot be copyrighted then it cannot be licensed under a free software license.
This is a concern - though the legal question is still a bit open on this. The question has been around how much human involvement there has been. A purely "create me a photo of a cat" prompt generating a picture of a cat has very little human involvement (fully AI generated).
A "generate some code to do this, no make it do it this way, rename these variables, etc." prompt "conversation" may be treated differently by the law. We don't know yet.