expression to say that one 'goes around a rule' to avoid it while not breaking it

Circumvent

to manage to get around [an obstacle], especially by ingenuity or stratagem; work around by outwitting

As in:

By obeying the letter of his mother's order, but not the spirit, the toddler circumvented the prohibition.


technically

It's very commonly and idiomatically used in (American) English for this situation. Saying "The child technically obeyed his mother", or "He obeyed his mother, technically" carries a strong implication that while he didn't violate the rules he did something that the rules were intended to prevent.

In spoken English the word "technically" would be stressed, and maybe drawn out a little, to highlight that it's the "technically" part that's important, not the "obeyed" part.


One might use the idiom: bend/stretch the rules TFD

to do something that is usually prohibited.

As in:

The toddler bent the rules.