The majority of scholars hold the opinion that it is permissible for both spouses to masturbate each other, because they are allowed to enjoy all kinds of sexual gratification with the exception of sex during menses and anal sex.

But this cannot be compared with self masturbation that is a result of unlawful sexual excitement. You cannot compare doing what is halal with doing what is haram, because both seem apparently the same. To eat, for example, you can buy the food from the store and you can also steal it. In both cases you will eat, but the first is halal and the second is haram. Similarly, you can obtain sexual gratification though marriage and you can obtain it through illicit relations. Results could be similar but the means are different. Committing what is haram has undoubtedly evil consequences in this world and in the hereafter if one does not repent.