The transverse polarization of $Lambda$ hyperons was measured in inclusive quasireal photoproduction for various target nuclei ranging from hydrogen to xenon. The data were obtained by the HERMES experiment at HERA using the 27.6 GeV lepton beam and nuclear gas targets internal to the lepton storage ring. The polarization observed is positive for light target nuclei and is compatible with zero for krypton and xenon.