The DAC in STM32 has a very limited drive capability natively, requiring tens of kOhm load. Therefore users often users switch on the internal buffer (amplifier). However, some users (e.g. here and here ) observed, that in such case the DAC output is inverted: highest output voltages are achieved when DAC was written with 0x000, and lowest output voltages when it was written with 0xFFF.
The reason for this behaviour is, that the output buffer was damaged (probably due to previous improper handling and/or overload).
As the output buffer is an inverting amplifier, when switched on, the DAC itself internally also goes into "inverted" mode, to counteract the amplifier's inversion. In the case of damaged amplifier it did not amplify thus invert anymore, the output was an exact copy of the internal output of DAC in "inverted" mode.