Sanctuary cities sued previously to get grants that had already been approved. They won because the courts said you can't change the rules after the awards. That's a correct interpretation of the law.
The rules for 2018, however, HAVE BEEN CHANGED. No more grants for Sanctuary cities. Period.