Federal law prohibits mixing government and private money. The A.T.F. now acknowledges it can point to no legal justification for the scheme. But far from reining in the spending, records show that supervisors at headquarters encouraged it by steering agents from around the country to Bristol.

Yet no one was ever prosecuted, Congress was only recently notified, and the Justice Department tried for years to keep the records secret. The Times intervened in an ongoing fraud lawsuit over the activity and successfully argued that a judge should unseal them. The documents tell a bizarre story of how federal agents set up shop inside a southern Virginia tobacco business, and treated its bank account as their own.

At least tens of millions of dollars moved through the account before it was shut down in 2013, but no one can say for sure how much. The government never tracked it.

THOMAS LESNAK, a veteran agent, operated out of a government office building tucked behind a Burger King in Bristol, a small city near the intersection of Virginia, North Carolina and Tennessee. Colleagues regarded him as fast-talking and likable. When he met suspects, he always came off as the good cop.