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