A federal judge on Friday ruled that slot machines that have operated for years in bars, restaurants and convenience stores across Missouri are illegal gambling devices under state law.