I don't see the distinction you're trying to make here.
It's plagiarism to copy someone's code without giving attribution. It's not plagiarism to copy someone's code if you give attribution.
It's plagiarism to copy someone's natural language text without giving attribution. It's not plagiarism to copy someone's natural language text if you give attribution.
In either case, copying someone else's code or natural text is potentially copyright infringement, but that's a different matter.
It's plagiarism to copy someone's code without giving attribution. It's not plagiarism to copy someone's code if you give attribution.
It's plagiarism to copy someone's natural language text without giving attribution. It's not plagiarism to copy someone's natural language text if you give attribution.
In either case, copying someone else's code or natural text is potentially copyright infringement, but that's a different matter.