Well for iOS it is going to be very difficult, not to build, but laws in every country and state.
Also the App Store Review Guidelines has real strict rules about it:
20.3 : It must be permissible by law for the developer to run a lottery App, and a lottery App must have all of the following characteristics: consideration, chance, and a prize
20.4 : Apps that allow a user to directly purchase a lottery or raffle ticket in the App will be rejected
20.5 : Apps that offer real money gaming (e.g. sports betting, poker, casino games, horse racing) must have necessary licensing and permissions in the locations where the App is used, must be restricted to those locations, and must be free on the App Store
20.6 : Apps that use IAP to purchase credit or currency to use in conjunction with real money gaming will be rejected