Typically, to gain lean body mass one needs to have some degree of caloric surplus, or at the very least, not be in a significant deficit. This is especially true when looking to add muscle mass. It is certainly possible to gain muscle mass on a ketogenic diet. For most individuals this would require consuming adequate protein (while still remaining in ketosis), enough calories to support growth, sufficient electrolytes to support muscle function, as well as incorporating progressive resistance training. The type and volume of resistance exercise needed to add lean body mass will be very dependent on the individual and their age, training status, health status, etc. Therefore, the answer to this question can become quite nuanced, but in simple terms, yes, it is very possible to gain lean body mass on a ketogenic diet while still taking advantage of the health promoting effects this way of eating provides.
A ketogenic diet helps control blood sugar levels. It is excellent for managing type 2 diabetes, sometimes even leading to complete reversal of the disease. This has been proven in studies. It makes perfect sense since keto lowers blood-sugar levels, reduces the need of medications and reduces the potentially negative impact of high insulin levels.