The ruling says the Energy Department exceeded its authority by extending the plant’s operation.