Origin of term "joint" as a place?

It occurred to me that I have no idea how “joint” came to mean a place, usually a dive or second-rate bar or restaurant. The best I could find in a quick etymology run was that such places (like opium dens) used to be adjoined or joined to a main establishment. That doesn’t seem convincing.

Any better Dope?

Here’s the cite:

Why doesn’t it seem convincing? The Master said:

But even Cece is forced to fall back on “seems to.” I was hoping there was a cite or expert opinion that went past perhaps and seems-to.

Good enough, I guess. Thanks.

Department of facetious unhelpfulness: but I remember hearing from a performer at a folk-music club: “he probably learnt that at his mother’s knee, or some other low joint”.

Not the case, unfortunately.

And, the OED 1821 cite really doesn’t relate to the meaning we’re looking for.

So, it’s chiefly US underworld slang originating in the second half of the 19th Century.

“I wish coke was still cola and a joint was a bad place to be”.

~Merle Haggard

But the joint was definitely the added-on room …
It seems to come to mean " cannabis cigarette" due to that origin.

Does the expression “Juke Joint” add to, or derive from the use of “joint” to mean dive?

"Of all the gin joints, in all the towns… "

Also, why are Spike Lee movies “joints”?

Rap/hip-hop songs are also sometimes called joints.