You could be arrested at the scene or you could be arrested later.  When you are arrested depends on the police undercover operation.  For example, if the police believe that you could lead them to others involved with drugs, they might want to arrest you later rather than immediately.