When following the license terms, preserving the original copyright, etc, sure.
However, honest, ethical people (including programmers) do not plagiarize.
Copying and pasting code without attribution is plagiarism. Doing it without following the licensing terms is a copyright violation.