Minimizing flow on a 2D matrix network
Build a grid graph, with one node per entry in the matrix, and edges between each pair of adjacent nodes.  Also add a source node $s$ with an edge from $s$ to each blue node, and a sink node $t$ with an edge from each white node to $t$.  Set the capacity of each edge to 1, except the $s$-to-blue edges have capacity $\infty$, and the white-to-$t$ edges have capacity given by the cost of allowing that white node to become blue.
Now, find the minimum $(s,t)$-cut in this graph, using any network flow algorithm.  The $s$ side of this cut will contain all of the nodes that become blue, and the edges that cross the cut will indicate where to place blocks (for blue-to-white edges that cross the cut) and which white nodes become blue (for white-to-$t$ edges that cross the cut).

Why does this work?  We're going to treat the final colors as defining a cut $(B,W)$: $B$ contains all nodes that are ultimately blue (and $s$), and $W$ contains all that remain white (and $t$).  This means that any edge between an ultimately-blue node and an ultimately-white node crosses the cut, which matches the problem requirement that such an edge must have a block on it.  Also, if $b \in B$ is any node that was originally white but becomes blue, then the edge $b \to t$ crosses the cut (since $t \in W$), so we think of it as having a block between it and $t$.  Finally, we want to know the cheapest way to choose a set of blocks.  The total cost of a set of blocks is the sum of the capacities of the edges that were blocked, so this total cost matches the total capacity of the edges that cross the cut $(B,W)$, i.e., the capacity of the cut.  So, finding a min-capacity cut will find you the cheapest way to place a set of blocks that match the problem requirement.