He asked you if he can search your bag,most of asked for a reason then the question might be if the stop was justified.It can look pretty murky if the cases can't get dismissed then a plea bargain might be your best bet. The fact he found weed before,the scales and baggies plus the cash makes you look like a drug dealer. Never carry drugs and money at the same time,4 oz isn't a pound but it's more then enough for personal use and I would think this guy is selling. It hard to say b.c everywhere is different but your probably are looking at some jail time or felony probation. Your friend admitting to the weed and the fact his prior encounter with you could be enough to fry you.

