It had been hanging off Kiloh’s bumper ever since he nosed out of the parking lot behind his medical-marijuana dispensary with $40,131.88 in cash in the trunk of his hatchback.

Kiloh was unarmed, on his way to City Hall to make a monthly tax payment, and managing only stop-and-start progress in the midday traffic. He was afraid of one thing above all else: getting robbed.

That fear is a constant part of doing business in California’s flourishing medical cannabis industry, in which transactions are conducted mostly in cash, sometimes in stunningly large amounts.

“The thing I need the least right now is to have to go through any sort of money disappearing,” Kiloh said.

On Jan. 1, recreational pot will become legal in California, creating what could be the world’s largest legitimate marijuana economy. It comes more than two decades after the state gave its blessing to medical cannabis.

But the emerging marketplace with a projected $7 billion value has a potentially crippling flaw: Many people who work in it can’t use a bank. Banks don’t want the risks of doing business with companies whose product remains illegal under federal law.

So while the sneaker shop next door to Kiloh’s storefront on Ventura Boulevard can send a check to City Hall to cover its taxes, or wire the money from a laptop, Kiloh has to make a stress-filled, 15-mile (24-kilometer) freeway drive each month to downtown Los Angeles.

California is to marijuana what Iowa is to corn, and what Kentucky is to bourbon — the nation’s bud basket, its heartland for production. The transformation of such a vast illegal economy into a legal one hasn’t been witnessed since the end of Prohibition in 1933.

The state expects to collect $1 billion in new tax revenue annually from pot within a few years. In L.A. — which is already estimated to have anywhere from 1,000 to 1,700 medical marijuana dispensaries, only about 200 of which paid city taxes in 2016 — the take is projected at $50 million next year alone.

However, governments will almost certainly miss out on money without an easy, secure way for businesses to pay. With no bank records, it will be harder to regulators to track funds and identify shady operators. And those who operate by the book will be undercut by those who don’t.

Kiloh, a 40-year-old with a graying mohawk and a degree in economics, counts 15 years in the pot industry as a seller and cultivator and is a partner and business manager at a San Francisco dispensary and the owner of the one in Los Angeles.

In the absence of a bank, Kiloh has become his own.

Twist and turn through a warren of rooms inside his shop, go through a door with a keypad lock, and you will come to a closet-like space that contains twin steel vaults, standing head-high. The walls around them are reinforced with steel.

Overhead, more than 50 cameras scan his offices and hallways and keep watch outside the building as well. An armed guard stands at the door to the sales floor.

On a typical day, $15,000 can change hands in his dispensary, where a steady stream of customers pick from shelves stocked with 700 products, from fragrant buds and perfectly rolled joints to cannabis-infused lip balm and potent concentrates known as “shatter” that look like thin sheets of amber glass.

For Kiloh, the cash is a daily hassle. It needs to be counted repeatedly to safeguard against loss. State and local taxes must be set aside and stored, sometimes for a month or more. When vendors show up, they get paid in cash, too.

“When now everyone makes payments through their cellphone, it’s tough to see that I’m left to the archaic version of counting money,” he said.

With all the cash on hand — he grossed $4 million last year — crime is a gnawing fear. His dispensary on a bustling commercial strip has been robbed twice — once by thieves breaking in through the roof.

The Los Angeles Police Department did not immediately respond to a request for statistics on crimes against marijuana dispensaries, and many cases are believed to go unreported anyway, since many businesses are loath to go to the police.

Last year, though, a dispensary owner shot and wounded two armed men during a holdup in the Los Angeles suburbs. And a security guard at a dispensary was killed in an attempted robbery in Aurora, Colorado, another one of the nine states to legalize recreational pot.

To keep criminals guessing, Kiloh avoids arriving at the same time each day and staggers the times he leaves. He goes in and out different doors. He keeps an eye on cars parked around his shop.

Once a month, Kiloh telephones to make arrangements to drop off his tax payment at the city Finance Department, which gets 6 percent of his gross revenue. They want to know he’s coming — it’s dangerous for them, too. The agency has seen bags of cash from pot businesses as large as $300,000 come through the door.

His journey to the tax office starts at a windowless back room at his shop, where stacks of $20 bills flip through the counting machine at his desk with the whir-slap-whir-slap of a weed-whacker.

He and his staff then wrap the bills into neat $2,000 bundles and wedge them into a long cardboard box, which is then covered in plain paper and stuffed into a shoulder bag that goes into the trunk.

From the moment he pulls out of his parking lot, he is watching, assessing.

“I find myself looking in my rear-view mirror hundreds of more times than I usually would in just normal traffic, making sure that I’m not being followed,” Kiloh said.

“That’s what a lot of this industry has been about: Just stay under the radar, and that’s your best defense. That’s your best kind of safety.”

It was on Kiloh’s drive to City Hall in late June that he noticed the ominous-looking Chevy. He watched it intently, taking note of the man behind the wheel — glasses, mid-40s to 50s — as he leaned into the accelerator.

Eventually, the Chevy disappeared, but Kiloh wasn’t home free yet.

Exiting the freeway, he tried to enter a parking lot near City Hall but was turned away, forcing him farther down the block.

Once inside a garage, he looped around until he found a spot near a stairwell. Lifting his satchel from his trunk, he scurried toward the door.

“I try to not stay in confined places like an elevator, so I’d rather take the standard stairs, plus the standard stairs have video cameras,” he said.

The steps opened to a sun-soaked plaza teeming with people. With the cash over his shoulder, he made his way briskly toward City Hall, his head swiveling.

“It’s tough when people make eye contact with you,” he said. “There is always the fear of what do they know?”

Kiloh spotted a police officer walking across the plaza — an instant source of comfort.

Finally at the granite-faced tower, Kiloh darted up the steps and slipped behind a pair of glass-and-wood doors. He emerged about 20 minutes later, his tax bill paid, and drew in a slow, deep breath.

“You just feel the relief,” he said, “to know that I don’t have to look over my shoulder.”