Hemingway didn't say it.
Peter De Vries did:Sometimes I write drunk and revise sober, and sometimes I write sober and revise drunk. But you have to have both elements in creation - the Apollonian and the Dionysian, or spontaneity and restraint, emotion and discipline.
That being said, Hemingway was known to have polished off more than a few adult beverages in his day:
“I have drunk since I was fifteen and few things have given me more pleasure. When you work hard all day with your head and know you must work again the next day what else can change your ideas and make them run on a different plane like whisky? When you are cold and wet what else can warm you?”
But, he didn't drink while writing. From a 1964 Writer's Digest article about Hemingway (based on an interview by Edward Stafford):
"Jeezus Christ!" Papa was incredulous. "Have you ever heard of anyone who drank while he worked? You're thinking of Faulkner. He does sometimes—and I can tell right in the middle of a page when he's had his first one. Besides," he added, "who in hell would mix more than one martini at a time, anyway?"
That was a hard shot at Faulkner*, but at the time they were the two stars of the American literary scene and competitive ... and ...Faulkner himself said:
“My own experience has been that the tools I need for my trade are paper, tobacco, food, and a little whiskey.”
Speaking of knocking back some booze, there are other writers of note who have thoughts about writers, writing, and drinking:
I'm not a writer with a drinking problem, I'm a drinker with a writing problem. - Dorothy Parker
In order to write at a high level of competence you need a
comprehensive vocabulary, a keen sense of overall structure, and an inner beat
or cadence. Your senses must be razor-sharp. Alcohol blunts those senses even
as it releases self-restraint. Therefore many writers feel they are getting
down to the real story after a belt or two, little realizing they are damaging
their ability to tell the real story. - Rita Mae Brown
I never drink while I'm working, but after a few glasses I get ideas that would never have occurred to me dead sober. - Irwin Shaw
I don't know any writers who don't drink. - James Baldwin
You have to have enormous discipline, especially if you like
your drink. I know so many writers who went down the drain. If you like to
drink, you can’t do it. It’s a reward. It should never be a crutch. - Robert Leckie
You know what Lawrence said: "The novel is the highest
example of subtle interrelatedness that man has discovered." I agree! And
just consider for one second what drinking does to "subtle
interrelatedness." Forget "subtle"; "interrelatedness"
is what makes novels work—without it, you have no narrative momentum; you have
incoherent rambling. Drunks ramble; so do books by drunks. - John Irving
Writer's block is a fancy term made up by whiners so they
can have an excuse to drink alcohol. - Steve Martin
The more I drink the better I write and the more I write the
better I drink. - Shawn Hatfield
There's an obvious romance to being the drinking writer. But
if I'm drinking, I'm not writing. - Liz Brixius
The idea that the creative endeavor and mind-altering substances
are entwined is one of the great pop-intellectual myths of our time. - Stephen
King
I often wonder if all the writers who are alcoholics drink a
lot because they aren't writing. It is not because they are writers that they
are drinking, but because they are writers who are not writing. - Natalie Goldberg
and finally, one more from Hemingway:
My training was never to drink after dinner nor before I
wrote nor while I was writing.
_________________________
*Want to know more about these rivals? Search: Faulkner Hemingway feud