"To work the system" means to take advantage of or manipulate the rules, procedures, or loopholes in a particular system or organization to achieve one's own goals or gain personal benefits, often through cunning or dishonest methods.
Full definition