The County Sheriff in most western states trumps everybody. POTUS, governors, legislators, judges - everybody.
It's just been so long since most of them exercised the power, they don't know they have it. Arpaio knows. Bernalillo County, NM former Sheriff Darren White knew. A few others will wake up to the fact, hopefully before it is too late.
Not one one word that allows a county sheriff to demand his permission for federal leos to conduct investigations within county borders.
Sheriff Mattis may think so, you may think so but neither can point to any ruling that says otherwise.