Ketamine's mechanism of action was assessed using gamma power from magnetoencephalography (MEG) as a proxy measure for homeostatic balance in 35 unmedicated subjects with major depressive disorder (MDD) and 25 healthy controls enrolled in a double-blind, placebo-controlled, randomized cross-over trial of 0.5 mg/kg ketamine. MDD subjects showed significant improvements in depressive symptoms, and healthy control subjects exhibited modest but significant increases in depressive symptoms for up to 1 day after ketamine administration. Both groups showed increased resting gamma power following ketamine. In MDD subjects, gamma power was not associated with the magnitude of the antidepressant effect. However, baseline gamma power was found to moderate the relationship between post-ketamine gamma power and antidepressant response; specifically, higher post-ketamine gamma power was associated with better response in MDD subjects with lower baseline gamma, with an inverted relationship in MDD subjects with higher baseline gamma. This relationship was observed in multiple regions involved in networks hypothesized to be involved in the pathophysiology of MDD. This finding suggests biological subtypes based on the direction of homeostatic dysregulation and has important implications for inferring ketamine's mechanism of action from studies of healthy controls alone.