Really? You must not have looked very hard. Even back when I went to high school (90s) it was possible to find complete book reports for just about any book online.
I've never done a book report, we we're made to tell the story in the book face to face or infront of class.
But I can imagine a teacher knows these type of sites, one or two google searches would reveal if the report is copied or not.
And still, what if the student copied it? What's the harm to the teacher? None,. The student only hurts himself with it.
And some of the programming courses at my University used the same assignments every year. Finding last year's answers was usually trivial.
Then the test makers are lazy, maybe that counts as a form of teacher cheating.
Then there's the fact that nearly all programming assignments allowed you to work in pairs. This usually meant that one person did the work for one class, and the other for another class. This means that there's one subject that each of the two never actually did assignments for, and thus wasn't tested in.
If they all hand in the same program, they can share credit.
I've done the assignments you talk about and I did not experience quite what you describe.
We've helped each other understand the assignment and the solution. Sure, there were students who piggy backed on some of the others, but in other courses it was exactly reversed. We all grew from each others experience. I've done projects where I did little, and I've done projects where I did nearly all. But learned from them all.
And what if they both claim to have come up with it independently? You have to give them both full credit, otherwise you're punishing them for cheating, which you want to explicitly allow so you can't punish them for it.
I'm not punishing at all, I'm giving credit to each individual piece of work. If two students come up with the same solution, they can share the credit.