IANAL and the legal specifics vary from state to state, but it is a consistent rule of law throughout the United States that parental abandonment is in fact a crime outside of specific legal exemptions. Indeed, safe havens were heavily debated as dangerously undermining the parental abandonment laws, and the counter-argument was that was absolutely true, but that protecting abandoned infants should be the priority over punishing abandoning parents.
Note that when baby box / safe haven laws started being widely adopted in the early 2000s, Nebraska initially did not impose an age limit which resulted in children of all ages being abandoned under safe haven provisions. This loophole was amended out within about six months, and no other state had it.