This is a tricky situation unfortunately.
It seems a previous owner your side may have built right on the boundary with the foundations going over next door, hence the tiny gap. So maybe they have joined your foundations up with theirs, which they are allowed to do.
As regards the earth in the...