King Charles III of Spain established "la lotera nacional," which started out as a hobby for the elite before traveling ferias  or fairs were introduced for the masses to come and play.
You may be surprised to know that the quintessential Mexican game called La Lotera has its origins in Europe and came to Mexico by way of Spain. The traditional Loteria originated in Italy, moved to Spain, and finally came to Mexico in 1769.