There is a total loan cost formula:
number of payments = 12 * 30 = 360
where rate = MONTHLY loan rate = .05/12 = 0.004166666666666670
total = rate * principal * number of payments / (1-[(1 +rate)^-n]
total = ( 0.004166666666666670 * 150,000 * 360) / 1 -[((1 +rate)^-n)]
total = ( 0.004166666666666670 * 150,000 * 360) / 1 - ((1.004166666666666670)^-360)
total = 225,000 / (1 - 0.223826595641353)
total = 225,000 / 0.776173404358647
total = 289,883.68