Ownership of the code generated by AI is not automatic, as AI generates code based on pre-existing data (source code) with different licenses.
To avoid legal issues, many LLM creators focus on the use of permissively licensed code (e.g., MIT, Apache 2.0) or code explicitly opted into training. However, to protect themself they still can ask you to accept liability for LLM usage.
IDE plugin developers that use LLMs for code generation can further push liability to users of their plugins. Right now, based on my analysis of popular IDE plugins, there are 3 options:
IP indemnity - plugin developer agrees to protect users against claims, losses, or damages arising from intellectual property disputes.
Source code reference tracker - plugin provides license details for generated code, and a user should make sure that source code license limitations are acceptable.
Users accept all liabilities - for any plugin usage, users accept all the liabilities.
See my IDEs plugin comparison (“Protection from legal risk”) for details on options provided to you by plugin developers.
Plugin developers can also use your code to train their models. I added another row to my IDE plugin comparison (“Disallow to store - code / history / telemetry”) so you can opt out if possible.

