In the middle of the opiate crisis, a Silicon Valley start-up called Practice Fusion saw an opportunity.

The company developed an electronic medical record system for doctors. Instead of charging for the software, like its competitors, the company generated the bulk of its revenue by advertising to doctors.

And it used that advertising system to encourage physicians to prescribe opiates, according to the Department of Justice.

"As part of the criminal resolution, Practice Fusion admits that it solicited and received kickbacks from a major opioid company in exchange for utilizing its EHR (electronic health record) software to influence physician prescribing of opioid pain medications," the Department of Justice news release states.

Specifically, Practice Fusion solicited a payment of nearly $1 million from an opioid company to create an alert that would would encourage doctors to prescribe more extended release opioids, while in the room with a patient. These alerts are known in the industry as "clinical decision support," and are intended to guide doctors to the most appropriate care. Reuters later reported that the company paying the kickback was Purdue Pharma.

Practice Fusion, which is now owned by AllScripts, a larger company in the space, agreed to pay $145 million in fines to resolve criminal and civil charges. That includes $113.4 million to the federal government, and up to $5.2 million to states, to resolve claims related to the kickbacks. The remainder of the fines are to settle other claims over how company allegedly misrepresented the capabilities of its software to get government certifiations.

One of the investigators on the case described the practice as "abhorrent."

"The companies illegally conspired to allow the drug company to have its thumb on the scale at precisely the moment a doctor was making incredibly intimate, personal, and important decisions about a patient's medical care, including the need for pain medication and prescription amounts," said Christina E. Nolan, U.S. Attorney for the District of Vermont.

Nolan said her district will not tolerate technology companies "influencing" patient treatment.

Brian Farley, Allscripts' chief administrative officer and general counsel, said in a comment to CNBC that the company is "pleased" to complete the settlement and that the conduct was disclosed prior to the acquisition in January of 2018. "As a company, we are committed to maintaining the highest levels of professionalism and integrity, and since learning of this matter we have further strengthened Practice Fusion's compliance program."

Farley also notes that Allscripts is using its technology to fight the opioid epidemic. "We remain committed to Practice Fusion and believe this matter should not overshadow the important and valuable work it is currently performing."

Practice Fusion was once a darling of the burgeoning health-tech industry. The business was doing so well in 2015 that the New York Times reported that the company had hired banks to evaluate a 2017 IPO that would have valued the company at up to $1.5 billion. However, it ended up selling to AllScripts for $100 million -- less than the amount of venture capital it raised from investors including Peter Thiel's Founders Fund and Kleiner Perkins Caufield & Byers.

Once the company sold, most employees got nothing while the company's executives walked away with millions of dollars in a pre-arranged carve-out, CNBC previously reported.