Results seem to be very inconsistent between different versions of MicroPython. Running the exact same code in some it works as expected and in others the results are wrong (full results below)
My guess is either the code to set attenuation is not working correctly in some versions, or there is some other factor to do with the ADC that is set differently by default on some versions.
Aref width val V Arduino IDE esp32 Version 1.0.6 3.30V 4095.00 1840 1.48V UIFlow_StickC_Plus-v1.9.3-plus.bin MicroPython ae8b2b72a-dirty on 2022-03-04; 3.30V 4095.00 0 0.00V M5StickC-Plus with ESP32 UIFlow_StickC_Plus-v1.7.2-plus.bin MicroPython 34c92e7c8 on 2021-01-22: 3.30V 4095.00 0 0.00V M5StickC-Plus with ESP32 uiflow-b061698-esp32-spiram-4mb-20220304.bin MicroPython b061698 on 2022-03-04: 3.30V 4095.00 1849 1.49V M5STACK with ESP32(SPIRAM) github.com/micropython/micropython/ MicroPython ade2720 - 2022-03-09 3.30V 4095.00 1850 1.49V ESP32 module with ESP32 github.com/m5stack/M5Stack_MicroPython MicroPython ESP32_LoBo_v3.2.24 - 2018-09-06 3.30V 4095.00 142 0.11V ESP32 board with ESP32