The issue of photons in dielectrics: Hamiltonian viewpoint