This is a surprisingly hard thing to do.
There are multiple possible reasons for this lag:
One is that your mouse might be updated by the OS before Godot even gets to process the event that it moved. You can even notice the problem on sliders or windows of the OS itself, they never really are perfectly lined up with the mouse when you drag.
Second, graphics card are client-server accelerated graphics, which makes them a tiiiny bit longer to return a result than a direct (but slower) update of the screen data. I suspect the mouse does not even use accelerated graphics.
Third, Godot uses OpenGL double-buffering (triple?) to avoid flickering, which inevitably introduces one frame of lag. Desktop compositing might also play a role in this.
Fourth, Godot runs at 60 frames per second, so the time at which the result happens on screen is further delayed. You can reduce that time a little by not capping framerate and disabling v-sync, but there will still be a small delay.
Of course if your game runs too slow, that gap will increase but should then be fixed by optimizing the game.
If you want this for a custom mouse cursor, I think there are limited ways to get this working, but otherwise eliminating lag on a graphic following the mouse can be really hard, to my knowledge.