Plagiarism means copying ("borrowing") from others, although being expected to deliver self-made (original) work. This is still so if he/she merges a few of the compatible ones with cut-and-paste, and only applies a bit of make-up, for example, by renaming the variables (or, the names in the examples).
The criteria for plagiarism-versus-originality may differ for a high-schooler and a researcher. For a high-schooler, solving his/her homework oneself, even if it is unoriginal, it is O.K. Not taking from friends is enough. Whereas for a researcher, if any idea is taken from others, it must be referenced, and it must be clear what already existed, and what the researcher oneself is claiming as his/her contribution.
On Relevance to Industrial Spying: In some cases, some similar development may occur in more than one place at about the same time - as the history of knowledge has examples to tell. But an exaggerated case is always to be suspicious of. In other words, if there is so much similarity, and especially if it goes on, then some of the parties (or some third party) may be actually intruding into the privacy of the other(s), and stealing intellectual property. This is one of the best known issues and it is usually called industrial spying, or some name similar to this. It is related to plagiarism, but tracking "who is the source?" may be a bit more complicated, even if not necessarily impossible. We return back to our discussion on plagiarism, and leave the issue of (industrial) spying to a later discussion. (To be discussed, especially, if the readers make requests.)
If you have taken a programming course, in some university or high school, you might have probably observed that some of the friends in the class, rather than programming on their own, they gather what some other(s) have done. Then they may do a bit of variables-renaming, and/or a bit of screen-design change, and/or a bit of merging from multiple such projects, and present the resulting cut-and-paste as "his/her/their own solution"(s).
Indeed, such cheating have led some university people to write code to catch such copycats. I know of MOSS (by Aiken at The University of California, Berkeley) as an example of such a system for detecting software plagiarism. (The acronym MOSS stands for Measure Of Software Similarity.) Moss was launched as an internet-based software service for automatic determination of the similarity of C, C++, Java, Pascal, Ada, ML, Lisp, or Scheme programs.
Even if MOSS may not necessarily put an end to all plagiarism, and probably not even to all that happens in the field of program coding, in any case, its existence may be helpful for convincing the unexpecting reader to the existence of such a problem of plagiarism.
A sizely work may contain portions which are plagiarized, and portions that are not. In other words, it may still have some originality, but to present oneself as-if greater, the author may be cheating by not citing the references for the extras. In the old times, taking from others was more acceptable. (Cf. Shakespeare's remarks. Or, was that Montaigne? Or, both?) Nowadays, copyrights (and the like) are taken more seriously, and such remarks cannot be made explicitly - without first paying copyright fees, if applicable. Likewise, for music and songs, etc.
If the unauthorized copying is noticed anyway, it may lead to punishment and/or fee-claims. In case of a Ph.D., this may lead to a revoking of a Ph.D., etc. (May depend on the level of standards the particular Ph.D.-granting institution is willing to keep. It may also depend on whether the Ph.D. has really done some remarkable, substantial work already, except the plagiarized parts, but that still may raise doubts.)
This site features a discussion of an Un-credible-PhD-text which was granted a Ph.D. in the early 1980s. It is not only massively similar to previous work, it also messes the subject, at most, if not all, points there is a merge-clash (among the methods of the different sources). Furthermore, there are a lot of faults in the examples, even an intelligent kid was not supposed to commit.
In other words, it fails in both dimensions of value we expect from any work: Both originality (vs. plagiarism), and practical utility (usefulness) dimension, as well.
In evaluating the value for any work claiming some respect, two criteria come forth: Originality, and utility/substance. Various types of publications may appeal to different expectations.
A tutorial (textbook) need not be original, but needs to be helpful in understanding the topic better, or easier, as compared to not reading anything at all, as well as when compared with the competing textbooks. This is the same criterion for a teacher.
A research paper needs to carry some original thinking. This comes as a regular extension of the scientist's lives and works. After all, they are not the people who have chosen to take part in the society, by sitting at supermarket cash-registers. They have declared a choice for making their contributions in the advancement of scientific knowledge. A research paper is expected to be representing some advancement, which by definition, includes both originality and some justification-for-being-cared-to-pronounce, i.e., some substance.
For a PhD dissertation, the criteria for a research paper apply. And maybe, even more so, because that is a grant of a title, which has some key value in some of the currently established institutions, especially for the university professorships. There may be little checking of accomplishment, beyond that - especially in the lesser developed countries. You can read further, on the page CaseStudy: The Mr.Un-credible-Ph.D.
The discussions of issues relevant to utility in this section are in the broader context of computer science, Petri nets, E-nets, etc. as discussed in the other references. This will provide us with a base for discussing in the later sections, why we should conclude the Un-credible-PhD-text is a massive disaster by the measures of the utility criteria, too. (The utility/substance criteria including: Being readily applicable, being stable (gotcha-free) throughout the range it claims applicability, being easy for a first-use, as well as during or after software modifications, etc.)