This is the reason why jury nullification exists. It's just a shame that most citizens have no idea that it either exists, or is a valid choice when serving on a jury.
A problem with jury nullification is that the interactions between laws is complex and can easily have unintended consequences. I am overall in favor of jury nullification, but it requires an educated jury. The complexity of our system of laws makes that very difficult.