U = Tuples[{-2, -1, 1, 2}, 3];
pointsByZ = GroupBy[U, Last];
colors = {-2 -> Red, -1 -> Blue, 1 -> Green, 2 -> Orange};
Graphics3D[
Table[{z /. colors, PointSize[0.03],
Point[pointsByZ[z]]}, {z, {-2, -1, 1, 2}}], Axes -> True,
AxesLabel -> {"X", "Y", "Z"}, Boxed -> False,
Ticks -> {{-2, -1, 0, 1, 2}, {-2, -1, 0, 1, 2}, {-2, -1, 0, 1, 2}},
BoxRatios -> {1, 1, 1}, PlotRange -> {{-3, 3}, {-3, 3}, {-3, 3}},
PlotLabel -> Style["64 points colored by Z layer", Bold, 14],
ImageSize -> {600, 600},
Epilog ->
Inset[Grid[{{Graphics[{Red, Disk[]}, ImageSize -> 10],
"z = -2"}, {Graphics[{Blue, Disk[]}, ImageSize -> 10],
"z = -1"}, {Graphics[{Green, Disk[]}, ImageSize -> 10],
"z = 1"}, {Graphics[{Orange, Disk[]}, ImageSize -> 10],
"z = 2"}}], {Right, Top}, {Right, Top}]]
The corresponding graph produced by the foregoing code is presented as follows:
The axes of the default spatial rectangular coordinate system generated by the preceding code are arranged on one side of the graph. Please advise how to revise the code to render the axes in the conventional form illustrated below.

