No, the bank doesn't know if it's a fake check straight away. They find out weeks later during a reconciliation process with the bank that printed the check.
To add more context: the check is usually not completely fake. It has a legit bank routing and account number on it, typically a business that is also being scammed. So the money will likely actually get withdrawn from some random business’s account and only discovered weeks or even months later.