"You may not eat within your gates...and the firstborn of your cattle"—Deuteronomy 12:17.
It is forbidden for a priest to eat an unblemished firstborn animal outside of Jerusalem. In addition, it is forbidden for a non-priest to eat of a non-blemished firstborn animal, regardless of the location.
"But the firstborn of an ox, the firstborn of a sheep, or the firstborn of a goat you shall not redeem; they are holy"—Numbers 18:17.
It is forbidden to "redeem" a firstborn animal [i.e. exchange it for another animal or money that would be used to purchase another animal for sacrifice. Rather, it itself must be offered as a sacrifice].
It is, however, permitted to sell [a blemished] firstborn animal.