Its plagiarism if you claim the copied code is your own work. But schools and businesses often prefer to have a bright line around what you wrote. If I copy (retyping, cutting and pasting, etc.) something that someone else wrote, remove their name, put in my name as 'author', and tell people I wrote it, that's plagiarism.
Its not like fair use or licensing. If I copy "main(int argc, char *argv[])" from a text book or web site, its not plagiarism unless I claim I invented it. If I implement DVD encryption/decryption or JPEG compression/decompression and give appropriate credit, its not plagiarism, but I'm still in trouble, because I'm not LICENSED to have them. Even if I envented it syself in a clean, white room.
If I put someone else's implementation of something inside my code to compare my version with their theirs, not indicating what I wrote and what I copied, that's ambiguous. If I have a comment that reads, "Compare to my code" then I'm clearly not claiming authorship, its not plagiarism. If someone asks me and I say, "that's a solution I found in a book, on the internet, etc", that's not plagiarism. Whether or not its in comments or live.
Plagiarism is knowingly copying someone else's work and claiming that its yours.
I hope that helps.
Bill