This actually has been addressed, in all seriousness, by Ayatollah Khomenei. Apparrently the only rule is that you cannot eat the goat afterwards. Google Mark Steyn and blue book for some interesting reading.
wasn’t it some convulted thing like you could not eat the goat nor sell it for food to anyone in your village but could sell it in the next village over