This is an increasingly common scenario, in which tenants learn that the property they are renting is going into foreclosure and that they will eventually be evicted, so they stop paying rent.
Unless your purchase contract states that the property is to be delivered vacant, you may be stuck purchasing the property subject to "tenants rights." It is extremely difficult to get rid of uncooperative tenants, especially in Berkeley and Oakland.
If you are uncomfortable purchasing a property and then fighting with the tenants to evict them, you may be able to cancel the contract per your inspection contingency.
Regardless, you would be well-advised to speak with an attorney about this matter -- it will be worth the legal fee you incur to learn all of the options that are available to you. Rest assured that the tenants will do whatever they can to keep living in the house without paying rent. Unfortunately for you, there are many very effective pro bono attorney services in the area that will help the tenants.
I would be happy to provide you with names of very competent landlord-side attorneys if you would like to speak to one.
Cameron Platt, JD, CRS
Platt Inc. Real Estate