Trouble creating a volume from a plane
It's not working properly because you simply joined the two cubes. Now they are a single object, but in Edit Mode still two separate meshes with their own volume, but overlapping in some parts.
In order for the Boolean Modifier to work, the volumes you want to subtract from the landscape have to be either separate without overlapping or you have to create one continous volume for the overlapping cubes.
Since the overlapping is necessary in your case, you have three options, all require you to separate the cubes beforehand and make them two objects again:

Work destructively by first subtracting one cube, apply the modifier and subtract the second cube.

or:

Give the first cube a Boolean Modifier and join it with the second cube by setting it to Union, then choose the first cube for Difference in the Boolean Modifier on the landscape.

or:

Maybe the simplest way: put two Boolean Mdifiers on the landscape, choose one cube for the first modifier and the other cube for the second modifier.