There's not much grey area. Cops do it all the time and they've been given a nearly blank check from the Rehnquist court R.I.P. over the last 30 years or so. Even cases where cops have gone into prisons, posing as an inmate, and coaxed confessions from people in casual conversation have been upheld (complaint was that a person in a cell is detained, since walking away from the officer is not an option if you're in a cell, but the person wasn't read his rights before being interrogated).
The only thing a person can't do is entrap you. Basically they can't encourage you to break the law and then arrest you when you do. So an undercover cop acting as a prostitute can sand on the road and wait to be propositioned, but she can't come up to your car and say, "Hey baby, you want to take a ride for $50?" and then arrest you when you say okay.