No, it is not unlawful; there is no law requiring all banks to clear at the same or highest speed, so sometimes a check out of your account will clear before a check into your account. It is your responsibility to insure there is enough of a reserve to handle all checks you write, even if a check you are depositing is delayed (or, for example, stop-paid).