United States v. Owens, No. 1:08cr25, 2010 WL 4823103 (W.D.N.C. Nov. 22, 2010):
Defendant was indicted on federal charges while he was in state custody. Upon the indictment, he was transferred to federal custody pursuant to a writ of habeas corpus ad prosequendum. A prisoner detained pursuant to a writ ad prosquendum is considered to remain in the primary custody of the first (state) jurisdiction unless and until the first sovereign relinquishes jurisdiction over the person. The receiving sovereign (the federal government) is considered simply to be "borrowing" the prisoner from the sending sovereign. Thus, any time spent in federal custody pursuant to a writ ad prosequendum is credited toward his state sentence, not his federal sentence.