“Sometimes a cigar is just a cigar” is attributed to Sigmund Freud. But there is no evidence that he actually said it.
It means that sometimes a cigar is what it is and not a phallic symbol — an elongated object representing a penis.
“This line is beloved by showboat psychology professors who imitate Groucho Marx while telling students that Freud said that sometimes a cigar is just a cigar.”
From “Nice Guys Finish Seventh: False Phrases, Spurious Sayings, and Familiar Misquotations” by Ralph Keyes (HarperPerennial, 1993).