Apple CEO Tim Cook laughs with President Donald Trump during a meeting in the White House, Washington, March 6, 2019.Leah Millis | ReutersThe federal government will determine in the next few months whether Apple will get a tariff exemption on its core products.It’s a critical juncture for Apple and CEO Tim Cook: A 15% tax on Chinese imports would force Apple to raise prices or accept lower margins on its core products sold in the United States, including iPhones and Mac laptops.The decision will be made by the trade representative, but Cook has already appealed directly to the president with his thinking that the tariffs could hurt the company and give its top competitor an advantage.”I have a lot of respect for Tim Cook, and Tim was talking to me about tariffs,” Trump said in August. “And one of the things, and he made a good case, is that Samsung is their number-one competitor, and Samsung is not paying tariffs because they’re based in South Korea.”Trump seems to listen to Cook and take his concerns seriously. That’s a surprising development for a business leader who supported Trump’s opponent, Hillary Clinton, in 2016 and who has openly clashed with the administration on certain issues like immigration.One possible reason: Cook has taken care to cultivate ties with Trump and his family — a charm offensive that started shortly after Trump’s election and continues to this day.Cook has met with Trump over dinner at his golf course in New Jersey twice in the last two years. He’s attended state dinners hosted by Trump and has a good relationship with Ivanka and Melania Trump, White House officials say. Apple announcements have often found their way into Trump’s remarks or tweets when they fit into the president’s narrative. Trump goes out of his way to call Cook a “friend of mine.”Apple doesn’t engage in politics as a company. The company doesn’t have a PAC, and Cook has said it “shouldn’t exist.”Nonetheless, during the Trump administration, Cook has kept in touch with the president, and his strategy of showing up to meetings and making calls when appropriate has given Apple the president’s ear when the president’s policies collide with Apple’s corporate interests.That influence is about to be tested if Apple applies for tariff product exclusions. “Tim Cook meets with the president for strategic reasons, if the probability of [tariffs] were zero, they probably wouldn’t meet,” Loup Ventures managing partner Gene Munster said in August.Whether the Trump administration spares Apple remains to be seen. But Trump definitely hears Cook’s requests. “Others go out and hire very expensive consultants,” Trump said in August. “Tim Cook calls Donald Trump directly.”Apple declined to comment for this story.Where it started: The tech summitPresident-elect Donald Trump speaks as PayPal co-founder and Facebook board member Peter Thiel (C) and Apple Inc CEO Tim Cook look on during a meeting with technology leaders at Trump Tower in New York U.S., December 14, 2016.Shannon Stapleton | ReutersIt’s somewhat surprising that Cook has become the tech CEO most likely to call the president.Shortly after Trump was elected, he called the CEOs of several tech companies to meet at Trump Tower. Cook sat next to Trump and was photographed looking distinctly unhappy in pictures from that day.Cook had not been an early supporter: He hosted a fundraiser for Hillary Clinton in Palo Alto in 2016, and he was on a list of possible vice presidential candidates created by her campaign, according to a leaked email published by WikiLeaks. (Cook also supported Republicans; he also hosted a fundraiser for Paul Ryan in that summer.)In a message to Apple employees, Cook explained why he showed up to talk to Trump despite supporting his opponent. “Personally, I’ve never found being on the sideline a successful place to be,” Cook wrote in the post published by TechCrunch. “The way that you influence these issues is to be in the arena.”That’s been Cook’s guiding principle while dealing with the Trump administration.”Tim seems like the kind of a person who recognizes his company’s interest in having a seat at the table — whether or not you agree all the time,” a White House official said.Cook’s internal post included some insight into Apple’s legislative priorities, including “human rights for everyone” and “really combating climate change.”But it also touched on the top issue Apple lobbied on in 2016, according to an analysis from OpenSecrets: Taxes.”We have other things that are more business-centric — like tax reform — and something we’ve long advocated for: a simple system,” Cook wrote in the message to Apple employees.Goal achievedApple achieved part of that goal in December 2017, when Trump’s tax reform enabled Apple to repatriate hundreds of billions in overseas cash at a lower tax rate, saving the company an estimated $27 billion in taxes.A month later, Apple announced that it plans to pay $38 billion in taxes — signaling that Apple was planning to repatriate nearly $250 billion in overseas cash at a 15.5% percent tax rate.Apple’s press release also said that Apple would contribute $350 billion to the US economy over the next 5 years, although it was based on a very broad definition of “contribute,” which included money that Apple had planned to spend on U.S. suppliers. Apple also gave $2,500 in restricted stock to many of its employees as a one-time tax break bonus.Trump noticed Apple’s plans, tweeting on Jan. 17, 2018: “I promised that my policies would allow companies like Apple to bring massive amounts of money back to the United States. Great to see Apple follow through as a result of TAX CUTS. Huge win for American workers and the USA!”Two weeks later, Trump used Apple’s stats in his first State of the Union speech.”Since we passed tax cuts, roughly 3 million workers have already gotten tax cut bonuses — many of them thousands of dollars per worker. Apple has just announced it plans to invest a total of $350 billion in America, and hire another 20,000 workers,” Trump said. “This is our new American moment. There has never been a better time to start living the American Dream.”Later that spring, National Economic Council director Larry Kudlow said that Cook remarked “he loves the tax cut and tax reform” when Cook visited the White House. Cook attended a state dinner hosted by Trump in a very non-Silicon Valley tuxedo. He was joined by Lisa Jackson, Apple’s VP of environment and policy, who used to be the administrator of the Environmental Protection Agency in the Obama administration.’I don’t think the iPhone will get a tariff on it’The most important priority now for Apple in DC is navigating Trump’s trade war, which will start to affect Apple’s major product lines, including iPhones, iPads, and Macs on December 15 if the company doesn’t receive an exception.A tariff on Apple’s products would lead force Apple either to raise prices on products in the United States or to eat the cost itself.J.P. Morgan estimates that Apple would need to increase the price of an iPhone from $1,000 to $1,142 if the White House implements a 25% tariff on Apple’s imports, although analysts say that Apple is likely to absorb the tariff cost rather than passing it onto consumers. (Right now the iPhone would receive a 15% tariff if it does not get an exemption.)In the summer of 2018, Apple seemed confident that the iPhone would avoid tariffs.In an interview in June 2018, Cook said that “I don’t think that iPhone will get a tariff on it.” Two weeks later, the New York Times reported that confidence was the result of an assurance from the Trump administration.That summer was also when Cook laid out his feelings on tariffs. “Our view on tariffs is they show up as a tax on the consumer,” Cook said during an earnings call.The first challenge to Apple’s confidence came last fall, when the USTR finalized tariffs on $200 billion of Chinese imports. The list, called List 3, would affect significant Apple products, including the Mac Mini, Apple Watch, and AirPods.But on September 17, one week before List 3 took effect, Apple got a tariff exemption on its Apple Watch and AirPods products. Basically, the Trump administration excluded Apple’s products from tariffs on $200 billion in Chinese goods.List 4, first proposed by the Trump administration this spring, is poised to be even worse for Apple — the sweeping tariff list includes Apple’s crown jewel, the iPhone, which still makes up about half of Apple’s revenue.Analysts believe that Apple will apply for tariff exemptions for List 4, although the exclusion process has not started yet. Apple previously said in a letter to the government that List 4 would cover “all of Apple’s major products, including iPhone, iPad, Mac, AirPods, and Apple TV” and that “U.S. tariffs on Apple’s products would result in a reduction of Apple’s U.S. economic contribution.”Big plantsApple unveiled plans Thursday for a $1 billion campus in Texas that will create jobs for the tech giant outside Silicon Valley. The new campus — for engineering other functions, but not manufacturing — will be near the tech giant’s existing facility in Austin and initially accommodate 5,000 new employees, with room to grow to 15,000.SUZANNE CORDEIRO | AFP | Getty ImagesTariffs are part of a larger back-and-forth between Apple and the president centered on the company’s relationship with China.Apple doesn’t operate any of its own manufacturing, except for a small amount of production in Ireland. Instead, it enters into deals with contract manufacturers, who assemble Apple’s products — nearly always in China.Changing this has been a big focus for the president.”I’m going to get Apple to start making their computers and their iPhones on our land, not in China,” Trump said during a 2016 campaign rally.Trump’s focus on getting Apple to build domestically continued shortly after Cook called to congratulate him on his win in November 2016.Shortly after the election, Cook called Trump to congratulate him on his win. Trump brought up the China issue, and later said, “I got a call from Tim Cook at Apple, and I said, ‘Tim, you know one of the things that will be a real achievement for me is when I get Apple to build a big plant in the United States, or many big plants in the United States, where instead of going to China, and going to Vietnam, and going to the places that you go to, you’re making your product right here.’He continued: “He said, ‘I understand that.’ I said: ‘I think we’ll create the incentives for you, and I think you’re going to do it. We’re going for a very large tax cut for corporations, which you’ll be happy about,.”Trump repeated his claim about Apple “plants” less than a year later, in July 2017, saying that Cook “promised me three big plants — big, big, big.”The obsession with plants culminated in a game of brinksmanship this year. In June, Apple announced a new version of the Mac Pro, a low-volume, high-end computer that was previously assembled in Texas. It had not been redesigned since 2013.After the announcement, the Wall Street Journal reported that the new version was going to be assembled in China like other Macs. But in a surprise, Apple asked for tariff waivers in June on 15 different parts it needed to import — prompting Trump to tweet that “Apple will not be given Tariff waivers, or relief, for Mac Pro parts that are made in China.”As it turns out, Apple wanted to assemble the high-end, $6,000 computer in the same facility in Texas where the old Mac Pro was assembled. By the end of the week, Trump’s tone had already softened.”A man I have a lot of liking for and respect is Tim Cook, and we’ll work it out, I think they’re going to announce that they’re going to build a plant in Texas, and if they do that I’m starting to get very happy, okay,” Trump said in July.Last month, Apple announced that it planned to assemble the Mac Pro computer in Austin, Texas, after receiving tariff exemptions to import 10 of the 15 parts it needed for the Mac Pro.”We thank the administration for their support enabling this opportunity,” Cook said in a statement. Outreach to the whole Trump familyDonald Trump isn’t the only member of the Trump clan who enjoys talking to Cook. In January 2017, Cook was spotted eating dinner with the president’s daughter Ivanka Trump and son-in-law Jared Kushner in Washington, D.C.Melania Trump also enjoys talking to Cook, according to a person familiar with their relationship. They talked about Melania Trump’s “Be Best” campaign in Bedminster, New Jersey, earlier this year.Cook has continued to cultivate a relationship with Ivanka Trump. In February, Cook joined the American Workforce Policy Advisory Board, along with the CEOs of Lockheed Martin, Visa, and IBM, and in 2017, Cook joined the White House Office of American Innovation. Both of those boards are led by Ivanka Trump and Kushner. Cook is also involved in a program called the Pledge to the American Worker alongside Ivanka Trump.Cook and Ivanka Trump traveled to an Idaho elementary school last November for a photo opportunity. Apple had donated iPads to all teachers and students in the district. “He and Ivanka have a great relationship. Very positive,” a White House official said.Memberships on these boards are one reason for Cook to visit the White House. It was at a workforce advisory board meeting in March that Trump referred to Cook as “Tim Apple.” Most recently, Cook visited the White House in June as part of his responsibilities on the board.”Tim Cook, from Apple, who was here today, who’s also on the advisory board,” Ivanka Trump said in June.”Who just left. He just left our office,” President Trump added.Follow @CNBCtech on Twitter for the latest tech industry news.– CNBC’s Eamon Javers contributed reporting.