Of course you cannot use a Spherical gradient when you do not want a spherical cutout.
I would not use a Gradient Texture at all. What you need is the distance of the empty to the cube, but the problem is, a simple Vector Math node set to Distance will also result in a spherical cutout, because the location of the empty is just a point in space. So you have to get the distances on each axis separately.
Here I am using some Math nodes set to Compare after a Separate XYZ node to compare the distance to the center of the empty.
I do this by checking if the X, Y or Z value is 0 and the Epsilon value is the distance from the center which I want to be cut out from the cube. Multiplying the results of the comparisons give True (or 1 or white) for everything within the given distance from the empty on all axis. Everything further away will be False (or 0 or black).
Since I am checking all distances 1-dimensional on the axes separately, I do not get a spherical result.

I plugged a Value node into all Epsilon inputs to be able to control them all at once. This makes the empty cut out a cubic shape. You can of course control all axis individually if you want one side longer or shorter than the other.
I have used a Value of 1 here for the Epsilon because this way it will exactly cut out what the empty shows with its default cube size of 2 × 2 × 2 m and this way scaling the empty in Object Mode will make the cutout size follow the size of the empty:

This will not only work with scaling, but with rotating too just as if you would use a Boolean modifier with a cube as cutter:

By the way, you can do it without the need of a second object like the empty as well. Just use the cube Object coordinates directly and add some offset to it with a Vector Math node. Of course the empty is a better visual help than just some values, but nevertheless it can all be done within the shader without any other objects:
