IMO
ECompetition in the mid-nineteenth century by large western farms gradually caused farmers in Pennsylvania to turn to livestock raising, but before that it was predominantly grain-producing.
A. Competition in the mid-nineteenth century by large western farms gradually caused farmers in Pennsylvania to turn to livestock raising, but before that it was predominantly grain-producing -->
it is not clearly modifies for which NounB. Once predominantly a grain-producing state, competition in the mid-nineteenth century from large western farms gradually was causing Pennsylvania’s farmers to turn to livestock raising -->
dangling: competition cannot once be a grain-producing stateC. Pennsylvania’s farmers were gradually caused to turn to livestock raising by competition from large western farms in the mid-nineteenth century, but before that it was predominantly a grain-producing state -->
same error as (A)D. It was once predominantly grain-producing, but competition in the mid-nineteenth century by large western farms was gradually causing Pennsylvania’s farmers to turn to livestock raising -->
it here wrongly modifies for competition, because competition can't be a grain-producingE. Pennsylvania was once a predominantly grain-producing state, but competition in the mid-nineteenth century from large western farms gradually caused the state’s farmers to turn to livestock raising -->
best. precise meaning and structure