State investigators can conduct surprise inspections without judicial permission, the high court rules.