The Hopf–Tsuji–Sullivan dichotomy in higher rank and applications to Anosov subgroups