Yes, it certainly can be when it's properly punctuated.
The statement looks back on a day last week, when the teacher was grading
essays written by James and John. It tells of one particular sentence in the
essays, almost identically worded in both essays, except for one word difference.
James ... while John had had "had" ... had had "had had". "Had had" had had
a better effect on their teacher.