In statistical mechanics, I used to use the procedure that if $a_{ij}=a_i a_j$ $$\prod_i\; \prod_j a_{i}a_{j} = \biggl(\prod_i a_i\biggr)\vphantom{\Bigr)}^2$$
However, today I noticed, $$\prod_i\; \prod_j 2^{i+j} = 2^{\sum_i\sum_j(i+j)}=2^{n^2(n+1)}$$
$$\prod_i\; \prod_j 2^{i+j} =\prod_i 2^i \; \prod_j 2^j = \biggl(\prod_i2^i\biggr)\vphantom{\Bigr)}^2 = 2^{n(n+1)} $$
Why does the second method fail. When is it applicable?