Is there a way to cast a shadow only on certain objects/materials but not on others?
It's pretty interesting question, but the answer is surprisingly easy.
You need to duplicate part of the mesh, on which you need the shadow to be casted, give it Transparent shader and move it just a bit above the surface of the original mesh. Then to the casting object material, you need to add node setup shown below and voila.