Permutation test on two groups
Yes it does, you resample from the whole population without replacement $N_A$ samples, which are associated to group $A$, and the rest of the samples are associated to group $B$. As I understand, you compute the statistic for every possible permutation of the total population and you measure how the actual statistic compares in the distribution of all the permutations.
If your statistic is not extreme in the distribution among all possible permutations, then it's likely that $H_0$ is true. Otherwise, if your statistic is an outlier of that distribution it's likely that $H_0$ is false.