ثم المأمور به في حق الحسن نوعان
In respect of goodness, commanded acts are divided into two classes: good in themselves and good for the sake of something else.
Ḥasan bi-nafsihi denotes an act possessing the relevant goodness in itself rather than only as a means to another objective.
Ḥasan li-ghayrihi denotes an act whose required character is related to another required objective or consequence.
This is a functional legal distinction. For the first class, the obligation concerns the act itself; for the second, one asks whether the connected objective or underlying reason still remains.