You can use the source model <source_model>Magento\Customer\Model\Config\Source\Group\Multiselect</source_model> to get the customer groups.
But its does not return the group ‘NOT LOGGED IN’ .so I have created new model to have ‘NOT LOGGED IN’ in the list.
<source_model>PHPCodez\Hideprice\Model\Config\Source\Group\Multiselect</source_model>
<?php namespace PHPCodez\Hideprice\Model\Config\Source\Group; use \Magento\Customer\Model\ResourceModel\Group\Collection; class Multiselect implements \Magento\Framework\Option\ArrayInterface { protected $_customerGroup; protected $_options; public function __construct( Collection $customerGroup ) { $this->_customerGroup = $customerGroup; } public function toOptionArray() { if (!$this->_options) { $this->_options = $this->_customerGroup->toOptionArray(); } return $this->_options; } }