Yes this is legal and the amount charged by the merchant is governed by state law. I don't know about IL but in IN the merchant can charge the greater of $25 or 5% of the check not to exceed $250 for NSF checks.
_________________________
The opinions expressed are mine and they are not to be taken as legal advice.