If a friend buys a game on their Xbox One while on my account, will I be able to play the game on my console as well?
If they are using your account (Which I would never recommend due to security concerns) they could purchase a game doing that on their Xbox One and install it on their console. However the friend will not be able to play the game unless they own it or are using your account. But yes, it is possible to buy games on another console. Honestly it would just be easier to get a card and have you purchase the game instead.
Edit: Another alternative to do this (thanks to Timmy Jim for finding this) is to link both your and your friend's consoles together which would allow you to share games together and also allows you both to play the game at the same time. Here is a link Timmy provided on how to do it.