It is possible in code, but it isn't really a core feature.
I've built my own login screen and I've got impersonation working, but behind the scenes I'm using:
string domainUser = "extranet\\" + userID;
System.Web.Security.Membership.CreateUser(domainUser, password, email);
AuthenticationManager.Login(domainUser, false, true);