The bug
In a dedicated server, if you set the attribute gravity to 0 or less, you can stay in the air or float upwards. However, if you change it back to the default value (0.08), you will be instantly kicked out of the game.
Steps to Reproduce
Set up a dedicated server with default settings
Set your gravity to -0.01 to make yourself float upwards:
/attribute @s minecraft:gravity base set -0.01
Wait for over 5 seconds
Restore the default gravity:
/attribute @s minecraft:gravity base reset
Observed Results
You get instantly kicked for flying.
Expected Results
You would not get kicked.
Can confirm in 1.21.5.