That's not really how IP works with regard to code. If copypasta code were a real legal liability, the tsunami of lawsuits would've already happened: not because of AI, but because of the easy and intentional sharing of good solutions online (and a culture of using verified solutions instead of re-inventing the wheel every time you need one)