The source below is from the UK but I believe that the comments apply in the US also.
First, since most prisoners are poor and not able to pay the outside of the prison, why would anyone ever want to smuggle drugs into the prison in the first place?
Whilst most prisoners may not be wealthy it does not mean that they don't have access to money either directly or from relatives, friends or associates. Indeed, payment may be by way of "favors", part of gang association where the gang leader finances the supply or a range of other reasons.
The prison drug market does not run on cash. Small sales are generally paid for with tobacco or other items from the canteen, bought with prisoners’ limited earnings or with money sent from outside: drugs tend to sell in prison for about four times the street price. Large transactions are usually co-ordinated externally. Technology makes that easier. Mobile banking apps mean convict dealers can manage payments made outside the prison before doling out drugs. Satellite maps on smartphones facilitate the placement of a package flung over the walls. Prisoners are not supposed to have mobile phones, but these are smuggled in, too.
Second, since smuggling drugs is a crime, why would anyone ever take the risk to smuggle drugs into a place that is filled with police-officers?
Well yes, but they obviously consider the reward is significantly greater than the risk...(see the 4x cost mentioned above)...oh and a prison is run / staffed by corrections officers / prison officers who are not policemen.