An example of two $(n,M)$ codes that have the same distance enumerator, but not necessarily the same weight enumerator is any two cosets of a $[n,\log_2(n)]$$[n,\log_2(M)]$ linear code. Thus, the $(2,2)$ codes with codewords $\{00, 11\}$ and $\{01,10\}$ respectively have the same distance enumerator but not the same weight enumerator. Obviously the codes cannot be equivalent under a permutation of coordinates.
An example of two codes with the same weight enumerator but different distance enumerators is the pair of $(3,3)$ codes with codewords $\{110, 100, 010\}$ and $\{110, 100, 001\}$ respectively. Both have weight enumerator $2z+z^2$ but the codes are not equivalent under permutation of coordinates.
An example of inequivalent linear codes with identical weight enumerators (and thus identical distance enumerators) is the $[32,16]$ 2nd-order Reed-Muller (RM) code and the $[32,16]$ extended quadratic residue (QR) code. These codes are not equivalent under permutation of coordinates. The RM code has $155$ cosets that have $8$ coset leaders of weight $4$ while the QR code has no such cosets. In fact, cosets of the QR code that have coset leaders of weight $4$ have at most $5$ such coset leaders. The details are in Chapter 8 of my unpublished Ph.D. thesis "Weight Enumerators of Reed-Muller Codes and Cosets" Princeton University, 1973.