The code is obviously protected by copyright. Not sure why anyone would question that?
If the prompt is protected, then the output image will be too (and by the same owner). I suspect it depends on how detailed the prompt is (just like a tweet might not be eligible for copyright, unless it's a particularly creative joke/haiku/etc).