On the other side of main street from the jail where you have to bust Fred out, there will be a small alleyway. Have Scooby crawl underneath the fence to find the liquid soap, then go back to the side of the jail where the hole is blocked by the cart full of gold. Use the liquid soap, and it will slip right over.