Add the butter to a 14-inch cast-iron skillet and heat over medium-high heat until melted. Add the onion and saute until translucent, about 10 minutes. Add the garlic and a generous pinch of salt and pepper and continue to saute until fragrant, about 1 minute. Add the corn kernels, a pinch of salt and a few grinds of pepper, increase the heat to high and saute until the corn is warmed through and slightly charred, 1 to 2 minutes longer. Remove from the heat and season with additional salt if desired. Drizzle with half of the lime juice.
Stir together the mayonnaise and remaining lime juice in a small bowl; season with salt and pepper.
Drizzle the corn with the mayonnaise mixture and sprinkle with the Cotija, cilantro and chili powder. Serve warm.