A few things here: first, there's sometimes a clause in the contract that allows you to cancel if you cannot get fully financed. So if you cannot get the full balance, then you may have that right. But you'll need to carefully read the contract. If you purchased the car from a dealer, they should have already had the inspection complete. They do not have the right to sell a car with a bad inspection because it cannot get tags through the MVA. You may be able to cancel the contract on this ground as well. It's tough to say without reading through your paperwork. Start there.
This is not legal advice nor does it create an attorney-client relationship. This is for education and informational purposes only. It is always recommended that you contact an attorney with any concerns as each individual case is unique.
You just agreed to spend $30,000 for a car that can't pass inspection? What am I missing?
You have a complicated set of facts here. I suggest you consult a local consumer protection lawyer with experience in vehicle sales. You can find some on the website of the National Association of Consumer Advocates, www.naca.net.
Disclaimer: This site exists to provide information only. It is not legal advice. Answering your question does not create an attorney-client relationship. I am a Massachusetts lawyer. Any information provided on this site does not, except as explicitly stated, imply familiarity with laws or procedures peculiar to your state which may differ from those where I practice.