James Cash Penney, the son of a Baptist minister and founder of one of America’s enduring retail empires, probably rolled over in his grave.

Tucked in the glossy pages of JCPenney’s 2012 Father’s Day catalog was the kind of happy family scene one would expect to find there—only this particular photo featured a real-life same-sex couple, Cooper Smith and Todd Koch of Dallas, having a playful moment with their kids. At a time when gay marriage has been sanctioned in a dozen U.S. states (but not Texas) and in countries from Argentina to New Zealand, one would hardly think the shot indecorous. But the howls began almost immediately, with one conservative group charging the retailer with “promoting sin in their advertisements.” It wasn’t Penney’s first foray into this territory. The 111-year-old chain had already raised the hackles of the morality police for a similar ad portraying lesbian moms and for enlisting Ellen DeGeneres as a spokesperson.

In the wake of the gay dads ad, Penney’s stood firm, releasing a statement that said: “We want to be a store for all Americans.”

More and more brands want the same thing, making their intentions clear with similarly unambiguous advertising. Ray-Ban’s “Never Hide” campaign in 2007, the largest in its history and running in 20 countries, featured an ad showing two English gentlemen holding hands as they crossed the street. In 2012, a Gap ad portrayed two young men snuggled inside a T-shirt with the tagline “Be One.” This past March, Amazon Kindle ran a TV spot featuring two married men on vacation.

After years of baby steps toward LGBT consumers, who represent an estimated $790 billion in spending power, brands like Crate & Barrel, American Airlines and even Bridgestone tires have brought their marketing out of the closet, picturing same-sex couples that are unquestionably more than just friends. While it may seem like such ads rode a cultural wave of gay acceptance that began with Will & Grace and crested with Glee, it is actually a trend that was decades in the making, and a look back through advertising’s dusty annals reveals images of startlingly frank male-on-male intimacy dating back to the early 20th century. In fact, images of cherub-faced frat boys and muscled-up gods as well as even strategic bits of nudity—all key ingredients of contemporary marketing targeted to gay men—pop up as early as the 1920s in such mainstream publications as Life, Collier’s and The Saturday Evening Post. Some of the images are eyebrow-raisers even by today’s standards. The images tend to be ambiguous—and in many cases, furtive and inadvertent—but their presence is undeniable.

View the 16 Gayest Ads in History here.

Take the work of commercial artist J.C. Leyendecker, whose illustrations for brands like Arrow shirts and Interwoven socks in the ’20s and ’30s influenced the sartorial tastes of millions of American men—few of whom knew Leyendecker was gay. In retrospect, he hardly seems to have hidden the fact. His work represents a stereotypically homoerotic world of crew teams, lifeguards and hunky playboys, many of them modeled after Leyendecker’s young lover, Charles Beach. The ads drip with equal parts sweat and sexual innuendo. Tod Ruhstaller, curator of the Haggin Museum in Stockton, Calif., which houses the largest collection of Leyendecker’s work, ventures that the artist “was insinuating part of himself into his work—pushing the envelope, but very gently. He [also] had the ability to create an image that, depending on the observer and context, could be interpreted differently.”

In other words, with Leyendecker’s ads and with so many since, the gay subtext is a matter of opinion—or perhaps, perception. Consider a 1943 ad for Cannon towels portraying a company of soldiers skinny dipping somewhere in the South Pacific or a 1945 ad for Faultless pajamas showing three handsome young gentlemen getting dressed after an apparent sleepover. “It’s all in the eye of the beholder,” says Bruce H. Joffe, professor of communications at Mary Baldwin College in Staunton, Va., and author of A Hint of Homosexuality?: “Gay” and Homoerotic Imagery in American Print Advertising. “A straight person who looked at these ads in Time or Life magazines would just turn the page and not think anything, but someone with a gay sensitivity would say, ‘Oh my God, look at that!’”

Joffe attributes the obvious camp in these ads to what he calls “a kind of chuckle in the eye and pen of the illustrator”—a case of a gay artist slipping something past his oblivious, straight boss. But Joffe doesn’t rule out a bit of subconscious targeting. “Do I think that ad agency or client said, ‘We need to reach the gay market’? No. But by the same token, there was a gay community with its own language and symbols, some of them appearing in these ads. There’s just no question.”

Take Schlitz, the most Middle American, straight-guy beer brand ever. In the postwar years, it ran a series of print ads featuring pairs of men in a variety of settings—a camping trip, a train’s bar car. In a triptych of images in each of the ads, one guy would confess to the other that he was “curious” about the beer, after which he would “try it” and, invariably, “like it.” The knowing glances exchanged between the men (whose wives or girlfriends are always a good distance away) reads as pure camp—but only to the boys in the band.

The imperative that gay people stay in the closet during most of the 20th century necessitated a shared, private language. It not only permitted homosexuals to recognize one another, but also eventually gave brands a workable shorthand for the more explicitly gay marketing campaigns that would begin to crop up in the ’80s—even if they were relegated to gay publications, notably The Advocate and Out (formerly Outweek). With the unchecked AIDS crisis of the decade enabling a virulent streak of intolerance, brands were going out on a limb by reaching out to gay consumers—and “the code” gave them a discreet way to do it. It is no accident that a 1987 ad for Absolut vodka featured the work of Keith Haring, to the general public an underground artist but to the gay community a hero.

While many early out-gay ads were “extraordinary, high quality” creative, they also tended to be “stereotypical and pandering,” notes Gary Hicks, professor of mass communications at Southern Illinois University. They could also be downright silly. Hicks recalls a Budweiser ad picturing a guy reaching into the fridge for a beer with the caption “Another one’s coming out.” Another ad, also for Bud, shows a coffee table strewn with beer bottles, caps intact, with the line “Tops and Bottles.” This form of coded messaging may have resonated loud and clear to gay audiences, but Hicks notes it’s also patronizing.

On the flip side, talking in code worked for the handful of brands that were experimenting with gay-targeted ads in mainstream media by the ’90s. Case in point: a series of ads from 1994, each picturing the rear end of a Subaru and a different vanity license plate, including “P-TOWN” and “XENA LUVR.”

As Subaru’s then-director of marketing and advertising Tim Bennett recalls, “When we did internal research and showed the ads to straight employees, they didn’t pay attention to the plates.” Gay people, meanwhile, instantly recognized the first plate as shorthand for the popular gay vacation destination Provincetown, Mass., and the second as a reference to the TV show Xena: Warrior Princess, which had an enormous lesbian following. Looking back on the campaign, Bennett says the brand was “dipping its toe in the water. We were trying to prove that there was a gay market, so we did the coding thing.”

The ’90s also saw the nadir of coding’s cousin, the so-called gay-vague ad, in which an artfully constructed scenario was obviously gay—except when it wasn’t. It was in this era that the gay suggestiveness of certain print advertising also began to migrate to TV. Consider Volkswagen’s spot “Sunny Afternoon” from 1997 in which two young guys rescue a piece of furniture discarded on the street in their VW Golf—it debuted during the famous coming-out episode of the ABC sitcom Ellen. The show “was a media and cultural moment—and then this commercial comes on. But the two men were not overtly defined. They could be friends, roommates or boyfriends. It allowed for multiple interpretations,” says Mike Wilke, founder of AdRespect, an online archive of LGBT-themed ads. Wilke coined the term gay vague.

Integral as coding and gay-vague ads have been in the journey of brands figuring out how to market to LGBT consumers, they left a mixed legacy. While marketers like Borders and Budweiser no doubt pulled in gay dollars by tagging their ads with gay-pride iconography such as pink triangles and rainbow flags, the fact that these are largely clandestine symbols denotes a lack of true openness on the part of the brands. Likewise, gay-vague ads—which have become common in marketing, particularly in fashion and fragrance campaigns—are marked by a certain dubiousness of intent. “The reason for gay-vague ads is that brands want to reach as many demographics as possible without alienating any of them,” Hicks says. “But then if they draw too much attention to themselves, the brand can always say, ‘Oh, that’s not what we meant.’”

While maintaining a haze around its motives may give a brand wiggle room, it can also cause problems. In 1992, 20-year-old Mark Wahlberg (aka Marky Mark) stripped down to his boxer briefs for a series of now-iconic Calvin Klein ads appearing via billboards, bus shelters and virtually every magazine in the free world. Sales of the underwear went from $11 million to $150 million within a year, remembers the ad’s creator, Neil Kraft, the former svp of advertising and creative services at Calvin Klein. Plenty of those underpants shoppers were no doubt gay men, who along the way helped to make a marginal white rapper from Boston an international celebrity. Yet Wahlberg, a devout Catholic who would go on to become a serious Hollywood actor, never seemed all that comfortable with the idea of dudes admiring his six-pack—or other standout characteristics. Once Wahlberg got tagged a homophobe, gay men “began to sense they had been robbed,” as the British newspaper The Independent put it.

Despite the renown of the Marky Mark ad, none other than Kraft insists it really wasn’t gay per se. “It wasn’t a conscious decision to market to gay men, though it certainly wasn’t something we discouraged when we realized it was happening—we knew he’d appeal to both,” says Kraft, who went on to start his own shop, KraftWorks. Kraft thinks it’s foolish for any brand to exclusively target gay men, if only because they are a small percentage of the population. At the same time, he adds, it is “disingenuous for brands to say that they don’t want to appeal to them.”

More recently, gay-vague marketing led to a backlash against Abercrombie & Fitch CEO Mike Jeffries, who denied that the youth-oriented retailer targets gay men—even though its ads are shot by Bruce Weber, one of the foremost documentarians of beefcake, and feature frat boys showering together. Still, Jeffries insisted, “It’s not about any labels.”

As implausible as that comment may sound, it does raise a point. In a sense, nearly all these ads—from J.C. Leyendecker to Marky Mark to A&F—could be tagged as gay-vague. As Hicks points out, the gay community is apt to read meaning into any seemingly gay-friendly ad seeing as it is “so hungry to see images of itself and see mainstream companies recognizing their existence”­—whether the brands actually do or not.

Recent campaigns from the likes of JCPenney, Amazon, Gap and Ray-Ban may well be a sign that vagueness as a marketing convention is itself passing into history. These are brands, after all, not just hinting about homosexuality, but depicting the real lives of men and women to whom they are reaching out.

Hey, it only took a century.