Donald Trump was not wrong. Hours before his nominee for “drug czar” withdrew from consideration over his part in a law limiting the Drug Enforcement Administration’s ability to crack down on pharmaceutical distributors feeding the US’s opioid epidemic, the president took a shot at the influence of drug companies over Congress.

“They contribute massive amounts of money to political people,” he said, standing next to Mitch McConnell, the Senate majority leader.

“I don’t know, Mitch, maybe even to you,” he added.

Q&A Why is there an opioid crisis in America? Show Almost 100 people are dying every day across America from opioid overdoses – more than car crashes and shootings combined. The majority of these fatalities reveal widespread addiction to powerful prescription painkillers. The crisis unfolded in the mid-90s when the US pharmaceutical industry began marketing legal narcotics, particularly OxyContin, to treat everyday pain. This slow-release opioid was vigorously promoted to doctors and, amid lax regulation and slick sales tactics, people were assured it was safe. But the drug was akin to luxury morphine, doled out like super aspirin, and highly addictive. What resulted was a commercial triumph and a public health tragedy. Belated efforts to rein in distribution fueled a resurgence of heroin and the emergence of a deadly, black market version of the synthetic opioid fentanyl. The crisis is so deep because it affects all races, regions and incomes

Trump was right on both counts. Pharmaceutical companies spend far more than any other industry to influence politicians. Drugmakers have poured close to $2.5bn into lobbying and funding members of Congress over the past decade.

Hundreds of thousands of dollars have gone to McConnell – although he is hardly alone. Nine out of 10 members of the House of Representatives and all but three of the US’s 100 senators have taken campaign contributions from pharmaceutical companies seeking to affect legislation on everything from the cost of drugs to how new medicines are approved.

Trump’s nominee for drug czar, the US congressman Tom Marino, was forced to withdraw after a report by the Washington Post and CBS’s 60 Minutes highlighted his role in forging legislation that hinders the DEA’s ability to move against drug distributors or pharmacies recklessly dispensing the opioid painkillers at the heart of the epidemic, which claims more than 100 lives a day.

Marino’s acceptance of substantial donations from those same companies compromised his nomination to head the federal agency charged with tackling the opioid crisis.

But for Congress, the process was nothing unusual. Hundreds of millions of dollars flow to lobbyists and politicians on Capitol Hill each year to shape laws and policies that keep drug company profits growing. The pharmaceutical industry, which has about two lobbyists for every member of Congress, spent $152m on influencing legislation in 2016, according to the Center for Responsive Politics. Drug companies also contributed more than $20m directly to political campaigns last year. About 60% went to Republicans. Paul Ryan, the speaker of the House of Representatives, was the single largest beneficiary, with donations from the industry totaling $228,670.

The impact of so much drug company money coursing through the veins of Congress is often incremental or largely unseen by the American public, such as the industry’s efforts to block competitors in India from making generic versions of HIV/Aids medicines that are more affordable to developing countries.

But on occasion it has a hugely visible impact.

In his comments alongside McConnell, Trump was vocal in his criticism of what he said were pharmaceutical manufacturers “getting away with murder” by charging much higher prices in the US than other countries. That is the result of a 2003 law, in effect written by the industry, preventing the federal government from seeking bids for the manufacture of drugs and medical devices – a process used in other areas, such as defence spending.

Instead, the pharmaceutical companies can charge whatever price they want for drugs bought for the publicly run Medicare and Medicaid programmes – and the federal government has no choice but to pay up.

Tom Marino, second left, at a Trump rally in Hershey, Pennsylvania, in 2016. Marino faced scrutiny over donations from pharmaceutical companies. Photograph: Matt Rourke/AP

Meanwhile, the drug companies say that to allow foreign imports would endanger the quality and safety of medicines in the US. But that justification has been widely scorned in the face of escalating and sometimes opportunistic pricing, such as the surge in the price of EpiPen antidotes to allergic reactions last year, to $600.

Britain’s National Health Service negotiated a price of about $70 for the same product. Scores of attempts by some members of Congress to introduce legislation to bring down the price of prescription medicines or to let people buy them from Canada, where they are often cheaper, have failed to make it out of committee.

While lobbying shapes medical policy across the board, it has had a profound impact on the opioid epidemic as deaths quadrupled between 1999 and 2015. The pharmaceutical industry poured resources into attempting to place blame for the crisis on the millions who have became addicted instead of on the mass prescribing of powerful opioids.

The relatively small number of members of Congress who led the charge against the epidemic years before it became a significant political issue have struggled to push through legislation.

Representatives Hal Rogers and Mary Bono saw repeated efforts to pass laws curbing the mass prescribing of opioid painkillers fail amid concerted campaigns by the drug makers. Rogers and Bono founded the Congressional Caucus on Prescription Drug Abuse in 2010 and proposed several pieces of legislation over a number of years.

Bono, who was alerted to the opioid crisis after Chesare, her son with the late singer Sonny Bono, became addicted, said there was a false but effective campaign by companies profiting from the epidemic to portray any attempt to rein in the mass prescribing of painkillers as depriving millions of people of legitimate treatment for chronic pain.

“We were getting tremendous pushback from the industry. It was a massive, well-organised effort,” she said. “Of course we felt it, maybe indirectly at times. We didn’t have an awful lot of people lining up to help us.”

Some of the pressure came through industry-funded groups such as the Pain Care Forum, which spent $740m over a decade lobbying in Washington and state legislatures against limits on opioid prescribing and similar issues, according to the Center for Public Integrity.

Among those who received political contributions from the group were Senator Orrin Hatch, who took $360,00. The senator introduced legislation intended to head off one of the bills put forward by Rogers and Bono by proposing a federal study of pain treatment. Hatch, who is running for Senate again in 2018 even though he previously said he would not, is the recipient of the most political donations from the pharmaceutical industry so far this year, at $208,000.

Bono said the American Medical Association was instrumental in blocking another law, the Ryan Creedon act, to require doctors to get training on the risks of opioids. The AMA objected to it as a burden on physicians.

Drug companies gave more than $200,000 in campaign contributions to Jason Chaffetz (who recently left Congress), acting as the single largest donor to his re-election fights. Chaffetz, as chair of the committee on oversight and government reform, led an effort against the Centers for Disease Control and Prevention to reduce opioid prescribing by recommending that doctors first seek alternative treatments for chronic pain.

Lobbying by the wider healthcare industry also had an important impact on the shape of Barack Obama’s Affordable Care Act (ACA), widely known as Obamacare.

The chair of the committee drafting the ACA legislation, Senator Max Baucus, was at the time the single largest recipient of health industry political donations, with $1.5m given to his political fund over the previous year. Baucus led votes in the committee against the inclusion in the legislation of public insurance strongly opposed by private insurers who saw a threat to its profits.

Baucus was known within the health industry for annual fly-fishing and golfing weekends in his home state of Montana that lobbyists paid handsomely to attend. Other members of the committee received hundreds of thousands of dollars, including Senator Pat Roberts, who at one point tried to hold up the bill by claiming lobbyists needed three days to read it. The drafting of large parts of the ACA was done by a former vice-president of a major health insurer, Wellpoint.

In his attack on drug company money in American politics, Trump failed to mention that the companies were among the leading donors to his inauguration alongside tobacco and oil companies.

Pfizer, the maker of Viagra, was the largest pharmaceutical donor, giving $1m.