As Scott said, it is a matter of realizing that the various words have different meanings. There is an entry with the answer to the buffalo one on Wikipedia. Basically it goes something like this:
buffalo=the animal aka bison
Buffalo=the town in upstate New York
buffalo= a verb meaning to bully
Buffalo buffalo buffalo buffalo (that other) Buffalo buffalo buffalo.
It is easier if you substitute alternative words:
Buffalo bisons bully bisons (that other) Buffalo bisons bully.
For the had one, it becomes a bit more contrived. Let's use the seven-had version. In this case I imagine one "had" could be one person's name, another can be another person, and another one can be a type of food. So let's imagine that the person is actually called Malcolm, another is called Billy and the food is called pizza.
Had Malcolm had pizza Billy had had? (..hmm, not sure... it seems wrong without a "the" in front of "pizza")
For the longer version I was thinking of something more like a short conversation...
A: Had Malcolm had pizza?
B: Malcolm had had pizza, had Malcolm.
A: Had Malcolm?
B: Malcolm had! (I said!)
Which with the originals subbed back in would of course look like this:
A: Had Had had had?
B: Had had had had, had Had.
A: Had Had?
B: Had had!
Aren't you all glad I shared this with you? And if you see any flaws in the above, and if you are still awake, shout it out. There is probably a better answer to the seven-had version, but I am too sleepy to think about it any more.