The whole purpose of the law is to supersede contracts. If you could just write in a contract that law XY does not apply here, you could get rid of the concept of laws.