I'm not sure how Massachusetts figured it out in this particular case, but they did. I'm sure that with a little digging, it would be easy for them to search every public record involving Montana LLC's and look for out-of-state mailing addresses or such. I have never set up an LLC in Montana, so I don't know what information is collected during the process.
I would guess that if you are full-timing, with only a mail forwarding address of record and little proof that you are a "resident" of another state, it might be more difficult to track you down.
It might also be possible to compare the voting records or DMV records of a state looking for cash against the list of Montana LLC's.
Very little can be truly hidden in this information age. For all I know, if there is an allegation of a crime, it might be even easier for a state agency to get information from the public records of another state.