The purity of a state $\rho$ is $\newcommand{\tr}{\operatorname{Tr}}\tr(\rho^2)$, which is known to equal $1$ iff $\rho$ is pure.
Another quantity that can be used to quantify how close a state $\rho$ is to be pure is its rank. This equals the number of nonzero eigenvalues in the eigendecomposition of $\rho$, or equivalently, the minimum number of pure states that need to be mixed to obtain $\rho$. Again, $\rho$ is pure iff its matrix rank is $1$.
Consider now two states $\rho$ and $\sigma$. Their having the same rank clearly does not imply that they have the same purity. A trivial example of this is given by $\rho=I/2$ and $$\sigma=(1/2-\epsilon)|0\rangle\!\langle0| + (1/2+\epsilon)|1\rangle\!\langle 1|,$$ for small enough $\epsilon>0$.
It is however less trivial to see whether $\rho$ and $\sigma$ having the same purity implies their having the same rank. If these were generic matrices, it would not be true, but it might hold for unit-trace Hermitian operators. Is this the case?
I can see that it is for two-dimensional matrices: if $\rho$ and $\sigma$ have same purity, that means that $p^2+(1-p)^2=q^2 + (1-q)^2$, with $p$ and $q$ one of the two eigenvalues of $\rho$ and $\sigma$, respectively. But in this case $\rho$ and $\sigma$ having different rank means that one of the two (say $\rho$) has full-rank while the other one has rank $1$. This would mean that $q=1$ (or, equivalently, $q=0$), while $0<p<1$. But then the condition on the purity would become $p^2+(1-p)^2=1$, which clearly cannot be satisfied for $0<p<1$ (a nice geometrical way to see it is that the solutions of this equation are the intersection of the unit circle in 2D and the line $x+y=1$).
What about the more general case?