Justin Bieber made nice with a bunch of cops this weekend by getting 'em hopped up on caffeine.
Law enforcement sources tell TMZ ... Biebs took his Lambo for a coffee run Saturday night in Mission Viejo, and happened to show up as a few Orange County Sheriff deputies were waiting too. We're told Justin volunteered to cover their orders.
When even a few more deputies came in -- and happened to be JB fans -- he kept the goodwill going with selfies. Clearly, that photo ban doesn't apply to everyone. Don't worry, the baristas made out too with a $10 tip, we're told.
They chatted for about 15 minutes before Justin bolted ... at posted speed limits, we're sure.