My favourite similar construction:
I needed a sign for my fish and chips shop, so I ordered one online. What they sent me said "FishandChips", so I had to write to them and explain that there were supposed to be spaces between Fish and and and and and Chips.
They weren't sure what I meant. I suppose to be clearer I should have placed quote marks before Fish and between Fish and and and and and and and and and and and and and and and and and and and and and Chips and after Chips.
And you may well be wondering where I ought to have placed quotes and commas in that thing I just said...
If you'd called on the phone and said it out loud, the emphasis would have made the meaning straightforwardly interpretable. This... would not be the case for the buffalo sentence.
I was first introduced to this sort of recursive sentence construction with an example using two different words rather than one: for any n, "oysters^n split^n" is a grammatical English sentence. I find that (1) this is easier to get my head around than iterated-buffalo and (2) having grasped it makes iterated-buffalo easier to parse.
"Oysters" is a plural noun phrase. If N is a plural noun phrase then "oysters N split" is a plural noun phrase, meaning "oysters that are split open by N". So oysters^n split^(n-1) is a plural noun phrase for any positive integer n.
And then if N is a plural noun phrase then "N split" is a sentence, meaning that the things described by N split open. (Or run away quickly, but that's less likely for oysters.) So oysters^n split^n is a sentence for any positive integer n.
And now you can notice that "buffalo" is both a plural noun and a transitive verb, and furthermore a verb that can kinda-plausibly take buffalo as subject and object, which means that the first half of that construction works fine with "buffalo" taking the place of both "oysters" and "split".
(It's a little strange to use "buffalo" with subject but no object, so usually the last stage of the construction is done differently with buffalo.)
You can have as many as 11 in a row. Buffalo[-residing] buffalo [animals who] buffalo[-residing] buffalo [animals] buffalo [do themselves] buffalo buffalo[-residing] buffalo [animals who] buffalo[-residing] buffalo [animals] buffalo.
You can have unlimitedly many in a row, even without using "Buffalo" as an adjective.
Consider the noun phrase "buffalo(1) buffalo(2) buffalo(3)", meaning buffalo(1) who are buffaloed(3) by buffalo(2).
We can get more specific about who's doing the buffaloing: "buffalo(1) buffalo(21) buffalo(22) buffalo(23) buffalo3", where we have replaced "buffalo(2)" with "buffalo(21) buffalo(22) buffalo(22)" -- buffalo(21) who are buffaloed(22) by buffalo(23). Exact same structure here as in the original.
But now we can do the same to buffalo(22) as we did before to buffalo(2): "buffalo(1) buffalo(21) buffalo(221) (buffalo222) (buffalo223) buffalo(23) buffalo3". And so ad infinitum.
And then we can turn the whole thing into a sentence by appending "buffalo buffalo" (and, if we please, we can replace that last "buffalo" with a similar cascade).
This gets us buffalo-sentences of all odd lengths >= 3. If we're prepared to use buffalo (v.) without an object -- signifying that whoever-it-is buffaloes someone -- then we can take any of those noun phrases and just put "buffalo" after it, getting all lengths >= 2. Or if we're prepared to use it as an imperative, with an object but no explicit subject, then we can put "buffalo" before any of those noun phrases to get a sentence. If we are happy doing both at once then we can say "Buffalo!" as an imperative ("go harass someone!"). Or we can use it as a standalone noun: "Buffalo!" meaning "oh, hey, I just saw some buffalo"[1]. So buffalo^n is a grammatical English sentence for any positive integer n.
[1] Isn't there a visual gag in some movie where character A shouts "Duck!", character B doesn't duck but looks around in puzzlement saying "where?", and then character B is struck by a large ?inflatable? duck, or something? Same pair of meanings at play :-).
This is likely the least useful post I've published here. But maybe it's not entirely useless, plus I think it's somewhat entertaining, so I'll go ahead with it anyway.
The Sentence
As you may or may not have heard before, "Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo." is a grammatically correct English sentence. For those who are astounded by this, feel free to try to get behind its meaning on your own before reading on.
A first hint, particularly for non-native English speakers, is simply that "buffalo" in this sentence has three different meanings: a noun (the animal, ~bison), a verb (~to deceive), and a city (well, Buffalo).
As a hopefully sufficient explanation: another way to write the sentence would be "Bison from Bufallo, who other bison from Buffalo tend to deceive, deceive Bison from Bufallo". So the initial "Buffalo buffalo" is the subject, followed by "Buffalo buffalo buffalo" as a relative sentence, followed by "buffalo" as the verb and finally "Buffalo buffalo" as the object of the sentence.
If you want to know even more, there's a nice wikipedia article about it.
Reflections
Surprisingly, I'm not only writing this post to share the very valuable information of the nature of this interesting sentence. Additionally I'll leave you with the following mildly embarassing realization: I've known about this sentence for at least 10 years. But until a few months ago it remained a mystery to me. My attitude towards it had been something like "no way this can ever make sense to me! Surely the explanation of how it works is super complicated and maybe also boring and I may not be able to intuitively understand it at all". So I just lived in a state of ignorance, very occasionally wondering what it may be like to be the kind of person who is able to really grasp that sentence.
In hindsight, this of course seems rather ridiculous. Now I feel a bit bad for being the kind of person who heard about this sentence, was curious about how on Earth that can be a real sentence, but then didn't even spend the two minutes it would have taken to actually figure it out. Fixed mindset at work.
My own personal take-away is that this surely is not the only time in my life where I'm falling for that mental "this is surely out of my range" trap, causing me to accept not knowing/understanding/mastering something due to a similar kind of self-deception. It might in fact even relate to imposter syndrome: there's a number of things in my area of supposed expertise (and work) that confuse me, and I somehow have this ingrained belief that I won't be able to get behind these things even if I tried. So rather than trying to get a better understanding of these things, I instead just hope that nobody will notice. What makes this more difficult is that often it's not a conscious process. If I consciously thought "I will never be able to understand X", I would probably notice what an unlikely and limiting belief that is. But it's usually more of a vague feeling of beyond-me-ness that makes me flinch away from a topic, without a perfectly clear understanding of where that aversion is coming from.
So where does this leave us?
Firstly, If you're the kind of person who has managed to internalize the opposite behaviour – to be actively curious and to embrace the challenge of getting behind something you don't understand yet – I'd suggest you feel either grateful for or proud of having gotten there, as it seems like a very useful character trait.
As for me, I'll do my best to look out more for this internal motion of shying away from something because of some implicit fear of not being able to make sense of it. And hopefully this will allow me to ultimately change my attitude towards such occurrences to something more productive. If things to well, 6 months from now I'll be able to comment on this post again, and point to a few concrete examples where I overcame this aversion and actually sat down to understand something that used to overwhelmingly confuse me.