Allocating Emissions Permits in Cap-and-trade Programs: Theory and Evidence