Or for people using XNA when the system is flipped.
First
First calculate the mouse cursor in the world. Since the mouse position system in XNA is flipped subtract the mouse Y from the height of the screen.
var mouseinWorld = new Vector2((cursor.X * oldZoomLevel) - world.X, ((cursor.Y - screen.Height) * oldZoomLevel) + world.Y));
Now
var mouseinWorld = new Vector2(
(cursor.X * oldZoomLevel) - world.X,
((cursor.Y - screen.Height) * oldZoomLevel) + world.Y));
Now change your zoomlevel.
Next
Next is to calculate the new world location.
var newX = (cursor.X * newZoomLevel) - mouseinWorld.X;
var newY = mouseinWorld.Y - ((cursor.Y - screen.Height) * newZoomLevel)
Now
var newX = (cursor.X * newZoomLevel) - mouseinWorld.X;
var newY = mouseinWorld.Y - ((cursor.Y - screen.Height) * newZoomLevel)
Now update the world location with the newly calculated coordinates.
world = new Vector2(newX, newY)
world = new Vector2(newX, newY)