The ruling came after Trump said he would not return to Twitter even if his ban were lifted by Elon Musk, whose $44 billion offer to buy Twitter was recently accepted.