This question positions the laws of nature as if they are criminal laws, and as such, breaking them is immoral or unreasonable. Therefore, God cannot do miracles, because He can’t be immoral or unreasonable to contradict Himself.
But that is far from the truth. Moral and civil laws are laws imposed on people to enforce right behaviour. On the other hand, the laws of nature are not imposed on nature. Rather, they are laws that describe how nature behaves normally. The earth doesn’t wake up everyday reading a law that it should revolve around itself every 24 hours, or revolve around the sun every 365 days. It simply does so, and scientific laws aim to explain nature’s normal behavior. By understanding the ordinary behaviour of nature, one can know if a miracle happens, as it doesn’t comply with that ordinary behaviour.
For example, if you wake up one day discovering that a hundred dollar bill disappeared from your desk drawer, would you conclude that the 100 dollar bill broke the laws of nature or that there is an “agent”, that is someone, who stole the money? Similarly, miracles attest to God as the ultimate authority who can intervene to change nature’s course.