The president has publicly weighed the government taking stakes in artificial intelligence giants, as his position on regulating the industry shifts.