For that kind of code duplication (lots of lines duplicated lots of times), I'd say :
- either laziness (you just paste some code here and there, without having to worry about any impact it could have on other parts of the application -- while writing a new function and using it in two places could, I suppose, have some impact)
- or not knowing any good practice (re-using code, separating different tasks in different functions/methods)
Probably the first solution, though, from what I've generally seen :-(
Best solution I've seen against that : have your developpers start by maintaining some old application, when they are hired -- that'll teach them that this kind of thing is not good... And they will understand why, which is the most important part.
Splitting code into several functions, re-using code the right way, and all that often come with experience -- or you have not hired the right people ;-)