Arduino Due: ADC gain adjustment problem
Well, the solution was very simple. We just need to call adc_enable_anch() before changing gain or offset of the ADC. I improved my setup and the sketch works as expected now:

void setup() {
  analogReadResolution(12);

  // Configure ADC gain
  // Arduino/hardware/arduino/sam/system/libsam/include/adc.h
  adc_channel_num_t ch = (adc_channel_num_t)(g_APinDescription[aPin].ulADCChannelNumber);
  adc_enable_anch(ADC); 
  adc_set_channel_input_gain(ADC, ch, ADC_GAINVALUE_3);

  Serial.begin(9600);

  // Delay for serial stabilization
  Serial.println("Begin.");
  delay(2000);
}