I will be honest I have no idea about the Maryland Laws. But it would seem to me if the property was sold in a sheriff sales (a foreclosure) all leans against the property would have been wiped clean including lease. See http://www.oag.state.md.us/Consumer/landlords.htm. If you look through the material you will see a number you can contact number and talk to your local officials. Always make sure to get the name of the person you have spoken with.
Under traditional sales of income property the remaining part of the lease goes with the purchase of the property. The new owners generally have to options. Option one ride out the remaining of the tenants lease which is a legal contract or to give the current tenant financial incentive for moving out early. When the current tenant's lease is at an end the new owners does not have extend a new lease to the tenant and is than free to increase the rent.
I hope this is helpful.