Chief Justice John Roberts initially wanted to overturn the health-care act but later changed his position and formed an alliance with the court’s four liberal justices, two sources said on Monday.