Despite many states having some restrictions on private rainwater harvesting, it isn’t explicitly illegal in the US. Most current restrictions are based on old “prior appropriation” laws that date back to the time of early settlers who believed in the maxim, "first in time, first in right."
Here is a guide to current rainwater harvesting laws for each state:
https://worldwaterreserve.com/rainwater-harvesting/is-it-illegal-to-collect-rainwater/