A customer is buying two bags of potatoes, bag A and bag B. The mass of bag B is 3 kg more than twice the mass of bag A. The total mass of both bags of potatoes is 27 kg. Determine the mass of each bag of potatoes.

Let's assume the mass of bag A is x kg.

Then the mass of bag B is 2x + 3 kg.
Therefore, the total mass of both bags is x + (2x + 3) = 27 kg.
Simplifying the equation, we get 3x + 3 = 27.
Subtracting 3 from both sides of the equation, we get 3x = 24.
Dividing both sides of the equation by 3, we get x = 8.
Therefore, the mass of bag A is 8 kg, and the mass of bag B is 2(8) +3 = 16 + 3 = <<16+3=19>>19 kg. Answer: \boxed{8, 19}.