President Obama praised Boston Red Sox designated hitter David Ortiz — a.k.a. Big Papi — during the team's visit to the White House on Tuesday to celebrate its 2013 World Series win. After presenting the president with his own Red Sox jersey, Ortiz managed to snap a “selfie” with Obama. (The Washington Post)

When President Obama went on “The Ellen De­Generes Show” last month, he joked that the host’s star-studded “selfie” photo at the Oscars — which was actually a Samsung product placement — was a “pretty cheap stunt.”

Now the joke is on Obama.

A photo that Red Sox slugger David Ortiz snapped with Obama during a White House Rose Garden ceremony Tuesday was orchestrated by none other than Samsung, the South Korea-based electronics giant. The picture was an immediate Internet sensation but was only later revealed to be contrived; the White House said Obama knew nothing about it.

In the raucous new world of social media and advertising, companies and their celebrity pitch people are doing all they can to stand out and create ads that are engaging enough to be shared widely via social media. When the power went out at the 2013 Super Bowl, Oreo tweeted that one can still “dunk in the dark” — a sentiment that became a trending topic. Taco Bell ginned up attention with a recent tweet arguing that while friends are temporary, tacos are forever.

Politicians are getting in on the act, too, and few have been as enthusiastic as Obama, who rode to reelection on a cutting-edge social-media campaign that capitalized on services such as Reddit and Instagram. The White House has enlisted sports stars and the moms of celebrities to help promote its health-care law online, and Obama recently appeared on the satirical Internet talk show “Between Two Ferns.”

But in the case of the Ortiz-Samsung selfie, some experts wondered Wednesday whether punking the president of the United States with a product placement goes too far.

“I think that it’s true the president’s putting himself out there in new mediums, but there’s still a certain reverence that goes with the office, and I just don’t think that’s a line I would advise a client to cross,” said Dan Hill, president of Ervin Hill Strategy in Washington.

The selfie in question seemed at first glance to be a lighthearted, unscripted moment during a White House celebration honoring the Red Sox, who won the 2013 World Series.

“What an honor! Thanks for the #selfie, @BarackObama,” tweeted Ortiz, known to fans as “Big Papi.” The attached photo featured the ballplayer wearing Ray-Ban sunglasses alongside Obama, who was holding a Red Sox jersey sporting the number 44 and his last name.

The picture was retweeted more than 40,000 times. Other photos of Ortiz snapping the picture with a Samsung Galaxy Note 3 also ricocheted around the Internet.

White House officials said Wednesday that neither they nor the president knew that Ortiz took the photo for promotional purposes. Ortiz had just signed a contract on Monday with Samsung’s mobile team, which came up with the idea, company officials said.

“Basically they heard he was visiting the White House, and when they heard that news they worked with David to plan that out,” said Theresa Cha, a Samsung spokeswoman. “They didn’t know what he would be able to capture.”

Ortiz, however, insisted in an interview with the Boston Globe Wednesday that he did not act to promote Samsung. “It had nothing to do with no deals,” he told the newspaper.

The Red Sox and Samsung have a promotional deal, but the team said it was unrelated to the photo.

Samsung Mobile wasted no time in promoting the selfie, retweeting it and adding a strategically placed Samsung Galaxy Note 3 to the background of its Twitter page. It also sent out a cryptic tweet prior to fessing up, playing off the fact that the stunt was pulled on April Fools’ Day.

“What’s the best prank you’ve ever pulled?” the company tweeted Tuesday evening.

Patrick Murphy, a professor of marketing at the University of Notre Dame who studies marketing ethics, said he thinks unwittingly roping Obama into an advertisement is “not ethical” — and also is a bad business strategy.

“I think there is cause for some ethical debate for things that occur with increasing frequency now that anybody with a cellphone and anybody with access to Twitter can seem to virtually put anything out there,” Murphy said.

Some companies have seen their attempts at buzzy advertising backfire. The Kenneth Cole designer label was roundly criticized for using the 2011 Cairo protests and events in Syria last year to promote clothes and footwear. AT&T came under fire for a promotional tweet last Sept. 11 that juxtaposed a phone against the backdrop of a Ground Zero memorial. SpaghettiOs deleted a tweet that depicted a piece of its canned pasta holding an American flag in honor of Pearl Harbor Day.

The Red Sox did not seem to mind that Ortiz took the photo, which helped distract from the team’s loss to the Baltimore Orioles the day before.

“Long before he became associated with Samsung, David Ortiz has taken selfies with fans, wounded soldiers, and other people he has met along the way, and we hope he continues to act with his big heart and kind spirit,” Sam Kennedy, executive vice president and chief operating officer of the Red Sox, said in a statement.

Ortiz is a seasoned pitchman in the Boston area and beyond, hawking his own salsa and hot sauce, promoting JetBlue flights to his native Dominican Republic and representing Dunkin’ Donuts, which New Englanders love almost as much as the Red Sox.

Jonah Berger, an associate professor of marketing at the University of Pennsylvania’s Wharton School of Business, said politicians and companies turn to social media because it seems more authentic than a traditional ad.

“I’m excited to share this cool picture of Obama next to a Red Sox jersey,” Berger said. “But do I want to share an ad for Samsung? Probably not.”

The Samsung stunt drew praise from some in the sports marketing world. Kris Koivisto, corporate communications manager for the Portland Trail Blazers basketball team, said he applauds Samsung for orchestrating two of the most shared photos the year — and making both seem unscripted.

“People are drawn to natural, spontaneous, behind-the-scenes moments captured by celebrities,” he wrote in an e-mail. “I, for one, will never be able to look at the photos of Ellen DeGeneres or President Obama without thinking of Samsung. So they win.”