The probe was closed without any charges being filed.
Olsen, 22, was subpoenaed by a federal grand jury on April 23, but her attorney had been in negotiations with federal authorities since then, the source said.
Olsen had wanted immunity before testifying. Olsen's attorney released a statement saying the actress "had nothing to do" with Ledger's drugs and had already provided "relevant information" to investigators.
The U.S. Attorney's Office and Olsen's rep both declined to comment.
Ledger, 28, was found dead in his Soho apartment on Jan. 22, and the coroner determined the actor died of an accidental overdose of prescription drugs for pain, anxiety and sleep.
Olsen Called When Body FoundThe federal probe focused on how he obtained Oxycontin and Vicodin, two powerful and often-abused painkillers for which Ledger had no prescription.
Masseuse Diana Wolozin found Ledger lying on his bed shortly after 3 p.m., and called Olsen three times, records show. The longest call lasted one minute and three seconds.
Wolozin told Drug Enforcement Administration agents she called Olsen because "it was the right thing to do" and spoke to her each time, but agents had not been able to confirm that with Olsen, the source says. They requested Olsen's phone records but had not yet received them, the source said.
Olsen's bodyguards arrived on the scene four minutes after Wolozin called 911, and just as the paramedics were arriving. They, too, cooperated with the federal probe but "had nothing pertinent to say," the source said.
Olsen was the only person who declined to be interviewed in the investigation, the source said. Model Helena Christiansen was interviewed as was Ledger's ex-girlfriend Michelle Williams and Ledger's family and friends.