You can not "join" n-to-n relations in SQL. You have to fire a extra query, means:
$result = [];
foreach ($customers->getResults() as $item) {
$result[] = array_merge(
$item->toArray(),
['groups' => $item->getGroups()->toArray()]
);
}
return $result;