This is what the drug epidemic has come to on Long Island — crack pipes being sold in vending machines.

For a few quarters, users have been snapping up ceramic glass pipes peddled from metal boxes in front of several apartment complexes and a busy shopping center, officials said Monday.

“At first, we were like, ‘Could this be a joke?’ But then we saw how intricate it was and realized it wasn’t a joke,” Michael Loguercio, councilman for Brookhaven Town District 4, told The Post.

The pol said local residents “were angry to find it in their community … they’re trying to keep their kids safe, and here is someone brazen enough to install this vending machine to sell crack pipes.”

The blue, free-standing vending machines are actually re-purposed tampon dispensers, a Brookhaven official said. They advertise that they sell “PENS” for eight quarters, or $2, a pop.

But the pens inside the machines are comprised of a long, thin glass pipe and come with a filter, which are then fashioned into drug pipes, authorities said.

“People that were selling crack, obviously there was trouble from their potential users getting crack pipes, and they thought this would be an ingenious solution,” said Brookhaven Town Supervisor Ed Romaine.

The first illicit vending machine, which touted “Sketch Pens,” was discovered at a Middle Country Road bus stop in front of the Coram Commons shopping center on Aug. 31, according to a photo posted to Facebook.

Two additional boxes were discovered Monday: One in front of the Fairfield At Medford apartment complex, and the other, labeled “S-PENS,” in front of a Home Depot in Coram.

The Brookhaven source said the dispensers were likely ripped out of public restrooms.

The boxes included a phone number — possibly scratched on to make them look more legitimate — but the number was a dead end, officials said.

The town sent the machines to the Suffolk County Police Department, noting that they were placed illegally.

Town officials are asking that anyone who finds another machine to report it.