When you use 'på' with 'byr'. (I'm not aware of any good rules for it, but på is commonly part of it)
"Å by", or "å tilby", means "to offer", while "å be" means "to ask (over)" (in this context).
So your first sentence technically means to offer someone coffee, while the second sentence means to ask someone over for coffee. However, when you ask someone over for coffee you're also offering them coffee, so they can be used near interchangeably in that particular context.