Optical Tamm states in photonic structures made of inhomogeneous material